【问题标题】:Maven: non-parseable POM when using jenkinsMaven:使用詹金斯时不可解析的POM
【发布时间】:2020-05-13 15:52:35
【问题描述】:

您好,我是 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>

【问题讨论】:

  • 请阅读错误信息Duplicated tag: 'repository' 也给出了行号...

标签: maven jenkins nexus


【解决方案1】:

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

&lt;distributionManagement&gt; 部分指定您的 Maven 工件应上传到何处。这里只能有一个repository 部分。否则,不清楚生成的工件应该上传到哪个存储库。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-17
    • 1970-01-01
    • 2015-08-02
    • 1970-01-01
    • 2013-04-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多