如何从.pom文件中排除父项依赖项“ <parent> </parent>”?

时间:2018-10-26 17:36:19

标签: maven spring-boot jenkins

I have an issue with a dependency in my pom.xml

<dependency>
    <groupId>com.risk.recoveries.common</groupId>
    <artifactId>disputemanager-client</artifactId>
    <version>1.7</version>
</dependency>

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
   <parent>
        <groupId>com.risk.recoveries.common</groupId>
        <artifactId>common-parent</artifactId>
        <version>1.4-HELIX-4.0.0-SNAPSHOT</version>
        <relativePath>../../../buildconfig/superpom/pom.xml</relativePath>
    </parent>
  <groupId>com.risk.recoveries.common</groupId>
  <artifactId>disputemanager-client</artifactId>
  <version>1.7</version>
  <name>Dispute Manager Client</name>
  <description>Dispute Manager WSDL client - JAX-WS generated stub</description>
  <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.8.1</version>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <id>install</id>
                        <goals>
                            <goal>aggregate-jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <linksource>true</linksource>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                        <configuration>
                            <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory>
                            <extension>true</extension>
                            <wsdlFiles>
                                <wsdlFile>DisputeManager.wsdl</wsdlFile>
                            </wsdlFiles>
                            <!--wsdlLocation>wsdl/DisputeManager.wsdl</wsdlLocation-->
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <executions>
                    <execution>
                        <id>clean</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                        <configuration>
                            <filesets>
                                <fileset>
                                    <directory>target/generated/cxf</directory>
                                    <includes>
                                        <include>**/*.java</include>
                                    </includes>                                 
                                    <followSymlinks>true</followSymlinks>
                                </fileset>
                                <fileset>
                                    <directory>${basedir}/src/main/resources</directory>
                                    <includes>
                                        <include>**/*genlog</include>
                                    </includes>
                                </fileset>
                            </filesets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>jaxws/wsimport/java</directory>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
    </build>
    <dependencies>
        <dependency>
            <groupId>com.infra</groupId>
            <artifactId>infra-core</artifactId>
        </dependency> 
        <dependency>
            <groupId>com.kernel</groupId>
            <artifactId>uKernelCore</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jmock</groupId>
            <artifactId>jmock-legacy</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.1.3</version>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
        </dependency>
        <dependency>
            <groupId>com.domain.risk</groupId>
            <artifactId>disputemanager-v3-client</artifactId>
            <version>0.0.5-SNAPSHOT</version>
        </dependency>       
    </dependencies>
</project>

所以在上面的pom文件中有这个父标记((common-parent),在我的工件正在下载的关系中不存在,所以我遇到错误,请找到下面的错误,我有什么办法吗?可以从争议管理者-客户端工件中排除此父标记(同父母)?请帮助我。

错误:

[错误]无法对项目riskactionmsgdDaemon执行目标:无法解析项目com.raptor.risk:riskactionmsgdDaemon:jar:0.0.1-SNAPSHOT的依赖项:无法在com.risk.recoveries.common:disputemanager上收集依赖项-client:jar:1.7:无法读取com.risk.recoveries.common:disputemanager-client:jar:1.7的工件描述符:找不到工件com.risk.recoveries.common:common-parent:pom:1.4-HELIX -4.0.0-SNAPSHOT公开(https://central.es.com/nexus/content/repositories/public/)-> [帮助1]

1 个答案:

答案 0 :(得分:0)

无法排除父级依赖项

disputemanager-client编写pom.xml的人严重滥用了<relativePath>元素。如果父pom不是引用它的项目的一部分,则根本不应该指定<relativePath>

首先,您需要验证Nexus存储库中的任何地方父pom.xml都不可用。请注意,SNAPSHOT人工制品(绒球,罐子等)通常存储在与已发布人工制品(版本中不含-SNAPSHOT的人工制品)不同的存储库中。可能是您的~/.m2/settings.xml文件没有正确设置。

如果您无法在Nexus的任何位置找到此文件,则应尝试从共同开发者那里获取副本。在文件系统中比项目高三级的位置创建buildconfig/superpom目录(以便relativePath进行解析),然后在其中放置父pom.xml(由联合开发人员提供)。

如果没有此文件的副本,您会发现很难继续,因为似乎已在其中指定了许多依赖项的版本信息。注意,许多disputemanager-client依赖项都没有<version>...</version>元素吗?这是因为这些版本是在缺少的父pom.xml(甚至是父级的父级)中指定的。