Maven:使用詹金斯时不可解析的POM

问题描述 投票:0回答:1

[嗨,我是jenkins和nexus的新手,所以,我正在尝试将jar文件推送到nexus。但是当我建立工作时,我得到这样的错误:

项目(C:\ Program Files(x86)\ Jenkins \ workspace \ job5 \ pom.xml)有1个错误[错误]不可解析的POM C:\ Program Files(x86)\ Jenkins \ workspace \ job5 \ pom.xml:重复标记:'repository'(位置:已看到START_TAG ... \ r \ n \ t ... @ 47:14)@第47行,第14列-> [帮助2]

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.scmgalaxy.mavensample</groupId>
  <artifactId>yoodle</artifactId>
  <packaging>jar</packaging>
  <version>5.0.0</version>
  <name>my-maven</name>
  <url>http://maven.apache.org</url>

<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
                <execution>
                    <id>attach-javadocs</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
    </build>

<distributionManagement>
    <repository>
        <id>sample_nexus</id>
        <url>http://localhost:8081/repository/sample_nexus/</url>
    <layout>default</layout>
    </repository>
    <repository>
    <id>maven-releases</id>
    <url>http://localhost:8081/repository/maven-releases/</url>
  </repository>
  <snapshotRepository>
    <id>maven-snapshots</id>
    <url>http://localhost:8081/repository/maven-snapshots/</url>
  </snapshotRepository>

</distributionManagement>

maven jenkins nexus
1个回答
0
投票

您的POM文件不是有效的XML文件。错误消息提示重复的repository标签。

<distributionManagement>部分指定应将Maven工件上传到何处。您在这里只能有一个repository部分。否则,尚不清楚应将生成的工件上载到哪个存储库。

[尝试从POM中删除repository部分之一,然后重新运行Maven构建。

© www.soinside.com 2019 - 2024. All rights reserved.