2015-10-15 100 views
0

當使用'uploadArchives'上傳檔案時,出現'無法初始化POM pom-default.xml:無法驗證POM'。我也試過maven-publish插件,但仍然沒有運氣。任何幫助將appriciated。Gradle:無法初始化POM pom-default.xml:無法驗證POM

下面是我gradle.build文件:

buildscript { 
ext { 
    springBootVersion = '1.2.6.RELEASE' 
} 
repositories { 
    mavenCentral() 
} 
dependencies { 
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
    classpath('io.spring.gradle:dependency-management-plugin:0.5.2.RELEASE') 
} 
} 

apply plugin: 'java' 
apply plugin: 'eclipse' 
apply plugin: 'idea' 
apply plugin: 'spring-boot' 
apply plugin: 'io.spring.dependency-management' 
apply plugin: 'maven' 
apply plugin: 'signing' 

jar { 
baseName = 'zmailapp' 
version = '0.0.1-SNAPSHOT' 
} 
sourceCompatibility = 1.8 
targetCompatibility = 1.8 

repositories { 
mavenCentral() 
} 


dependencies { 
compile('org.springframework.boot:spring-boot-starter-ws') 
testCompile('org.springframework.boot:spring-boot-starter-test') 
} 


eclipse { 
classpath { 
    containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 
    containers  'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.lau ncher.StandardVMType/JavaSE-1.8' 
} 
} 

task wrapper(type: Wrapper) { 
gradleVersion = '2.7' 
} 

task javadocJar(type: Jar) { 
classifier = 'javadoc' 
from javadoc 
} 

task sourcesJar(type: Jar) { 
classifier = 'sources' 
from sourceSets.main.allSource 
} 

artifacts { 
archives javadocJar, sourcesJar 
} 

signing { 
sign configurations.archives 
} 

group = "com.adadyn" 
archivesBaseName = "zmailapp" 
version = "0.0.1-SNAPSHOT" 

uploadArchives { 
repositories { 
mavenDeployer { 
    beforeDeployment { MavenDeployment deployment ->  signing.signPom(deployment) } 

    repository(url: "https://oss.sonatype.org/service/local/staging/deploy /maven2/") { 
    authentication(userName: ossrhUsername, password: ossrhPassword) 
    } 

    snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { 
    authentication(userName: ossrhUsername, password: ossrhPassword) 
    } 

    pom.project { 
    name 'ZmailApp' 
    packaging 'jar' 
    // optionally artifactId can be defined here 
    description 'A application used as an example on how to set up pushing its components to the Central Repository.' 
    url 'http://zmailapp.com' 

    scm { 
     connection 'scm:git:https://github.com/zishan2050/ZmailApp' 
     developerConnection 'scm:git:https://github.com/zishan2050/ZmailApp' 
     url 'https://github.com/zishan2050/ZmailApp' 
    } 

    licenses { 
     license { 
     name 'The Apache License, Version 2.0' 
     url 'http://www.apache.org/licenses/LICENSE-2.0.txt' 
     } 
    } 

    developers { 
     developer { 
     id 'manfred' 
     name 'Manfred Moser' 
     email '[email protected]' 
     } 
    } 
    } 
} 
} 
} 

回答

1

我通過在pom.project添加以下代碼{} gradle.build文件的塊解決了上述錯誤。

parent { 
    groupId "org.springframework.boot" 
    artifactId "spring-boot-starter-parent" 
    version "${project.bootVersion}" 
} 
相關問題