Jenkins在解析POMS时出现问题

时间:2016-04-07 16:34:31

标签: java maven jenkins jboss

为什么Jenkins在maven编译成功时会抛出这个错误?

父POM的内部依赖关系管理

          <dependency>
            <groupId>org.jboss.spec</groupId>
            <artifactId>jboss-javaee-7.0</artifactId>
            <version>${org.jboss.spec.jboss.javaee.spec.version}</version>
            <type>pom</type>
            <scope>import</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.jboss.resteasy</groupId>
                    <artifactId>jaxrs-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

在儿童pom

  <dependency>
    <groupId>org.jboss.spec.javax.jms</groupId>
    <artifactId>jboss-jms-api_2.0_spec</artifactId>        
   </dependency>

此处提到的罐子是javaee7.0 pom的一部分。我已将范围作为导入添加到父pom中。

ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.jms:jboss-jms-api_2.0_spec:jar is missing. @ line 105, column 21

[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.jms:jboss-jms-api_2.0_spec:jar is missing. @ line 102, column 20

[ERROR] 'dependencies.dependency.version' for com.sun.mail:javax.mail:jar is missing. @ line 110, column 20

[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.xyz.test:persistence-datamodel:jar -> duplicate declaration of version (?) @ line 126, column 21

[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.jms:jboss-jms-api_2.0_spec:jar is missing. @ line 30, column 20

[ERROR] 'dependencies.dependency.version' for com.sun.mail:javax.mail:jar is missing. @ line 34, column 19

[ERROR] 'dependencies.dependency.version' for com.sun.mail:javax.mail:jar is missing. @ line 59, column 20

[ERROR] 'dependencies.dependency.version' for org.jboss.resteasy:resteasy-jaxrs-all:pom is missing. @ line 153, column 24

[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec:jar is missing. @ line 159, column 23

[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.xyz.test:xab-commands:ejb -> version (?) vs 3.0.0.0-SNAPSHOT @ line 270, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.hibernate:hibernate-entitymanager:jar -> duplicate declaration of version (?) @ line 200, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.hibernate:hibernate-validator:jar -> duplicate declaration of version (?) @ line 206, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.jms:jboss-jms-api_2.0_spec:jar is missing. @ line 68, column 18
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.jms:jboss-jms-api_2.0_spec:jar is missing. @ line 69, column 21

    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:364)
    at hudson.maven.MavenEmbedder.buildProjects(MavenEmbedder.java:361)
    at hudson.maven.MavenEmbedder.readProjects(MavenEmbedder.java:331)
    at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1290)

1 个答案:

答案 0 :(得分:0)

此处you have missed some jars在依赖项和some jars are duplicate中添加版本。因此,发生此错误。

所以不要忘记依赖添加版本。

缺少罐子:

  1. 的JBoss-servlet的api_3.1_spec:罐
  2. 的JBoss-JMS-api_2.0_spec:罐
  3. javax.mail:罐
  4. 使用以下依赖项添加丢失的jar。

    <dependency>
      <groupId>javax.mail</groupId>
      <artifactId>mail</artifactId>
      <version>1.4.7</version> <!-- You have missed to add this version-->
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version> <!-- You have missed to add this version-->
    </dependency>
    <dependency>
      <groupId>org.jboss.spec.javax.jms</groupId>
      <artifactId>jboss-jms-api_2.0_spec</artifactId>
      <version>1.0.0.Final</version> <!-- You have missed to add this version-->
    </dependency>
    

    有些罐子是重复的。这导致以下错误。所以remove duplicate dependency

    [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.xyz.test:xab-commands:ejb -> version (?) vs 3.0.0.0-SNAPSHOT @ line 270, column 21
    [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.hibernate:hibernate-entitymanager:jar -> duplicate declaration of version (?) @ line 200, column 21
    [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.hibernate:hibernate-validator:jar -> duplicate declaration of version (?) @ line 206, column 21
    

    UPDATE:

    我已经给了一个样本。希望它会澄清你。

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.3.RELEASE</version>
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>
    

    如果父母和孩子的groupId相同。然后不需要在子pom中添加版本。