2016-09-14 1 views
2

개인 인공 저장소에 이슈를 게시하려고 시도 할 때 저장소를 볼 때 게시 된 POM에 대상이있는 종속성이 포함되어 있지 않음을 알게되었습니다. 당신은 내 잘못을 설명해 주시겠습니까?gradle publish에 pom의 종속성이 포함되지 않음

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     // Add this line 
     classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.1" 
    } 
} 



// Apply the java plugin to add support for Java 
apply plugin: 'java' 
apply plugin: 'com.jfrog.artifactory' 
apply plugin: 'maven-publish' 
apply plugin: 'maven' 
group 'CaptchaSolving' 
version '1.0.0' 



sourceCompatibility = 1.5 

// In this section you declare where to find the dependencies of your project 
repositories { 
    // Use 'jcenter' for resolving your dependencies. 
    // You can declare any Maven/Ivy/file repository here. 
    jcenter() 
    maven { 
     url 'https://artifactory.lyoko.pw:443/libs-release-local' 
     credentials { 
      username = "${artifactory_username}" 
      password = "${artifactory_password}" 
     } 
    } 
} 



sourceSets { 
    main { 
     java { 
      srcDir 'src/' 
     } 
    } 
} 






// In this section you declare the dependencies for your production and test code 
dependencies { 
    compile(group: 'com.pragone.custom', name: 'jpHash', version: '1.0.1') 
} 



task assembleRelease(type: Jar, dependsOn:classes) { 
    classifier = 'release' 
    manifest { 
     attributes 'Implementation-Title': project.group, 
       'Implementation-Version': version, 
       'Main-Class': '' 
    } 
    baseName = project.name 
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } 
    with jar 


} 



artifacts { 
    archives assembleRelease 
} 

def libraryGroupId = group 
def libraryArtifactId = rootProject.name 
def libraryVersion = version 
publishing { 
    publications { 
     jar(MavenPublication) { 
      groupId libraryGroupId 
      version libraryVersion 
      artifactId libraryArtifactId 
      artifact("$buildDir/libs/${artifactId}-${libraryVersion}.jar") 

     } 
    } 
} 

artifactory { 
    contextUrl = 'https://artifactory.lyoko.pw' 
    publish { 
     repository { 
      repoKey = 'libs-release-local' 

      username = artifactory_username 
      password = artifactory_password 
     } 
     defaults { 
      publications('jar') 
      publishArtifacts = true 

      properties = ['qa.level': 'basic', 'dev.team': 'core'] 
      publishPom = true 
     } 
    } 
} 

당신이 볼 수는

하나 개의 의존성이 게시 가져옵니다 치어는 다음과 같습니다

<?xml version="1.0" encoding="UTF-8"?> 
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>CaptchaSolving</groupId> 
    <artifactId>CaptchaSolving</artifactId> 
    <version>1.0.0</version> 
</project> 

은 당신이 할 수 (artifactory에서보기 탭에서 얻은) 을 참조하십시오. 지정된 저장소가 없습니다.

그래서 나는 단지 결과 pom에 저장소와이 프로젝트가 의존하는 의존성을 포함시키기를 원한다.

+1

나는'classpath' 범위에 익숙하지 않은 해요 . '컴파일 '을 의미 했습니까? – chrylis

+0

아니, 그 중 하나는 artifactory 예제에서 직접, 컴파일 단어와 함께 낮은 종속성을 봐주세요, 그게 내가 최종 pom에 포함하려고합니다. –

답변

2

나는 this post을보고 몇 가지 시도를 해본 결과 문제를 해결할 수있었습니다.

나타나는 블록 :

publishing { 
    publications { 
     jar(MavenPublication) { 
      groupId libraryGroupId 
      version libraryVersion 
      artifactId libraryArtifactId 
      artifact("$buildDir/libs/${artifactId}-${libraryVersion}.jar") 

     } 
    } 
} 

하는 실종됐다 :

from components.java 

때문에 최종 솔루션은 다음과 같습니다

publishing { 
    publications { 
     jar(MavenPublication) { 
      from components.java 
      groupId libraryGroupId 
      version libraryVersion 
      artifactId libraryArtifactId 
      artifact("$buildDir/libs/${artifactId}-${libraryVersion}.jar") 

     } 
    } 
}