java - 无法使用 Maven 解决 Artifact 错误

标签 java maven jakarta-ee

当我使用 Maven 构建模块时,出现以下错误: 谁能告诉我这个错误到底意味着什么?

[ERROR] Failed to execute goal com.dsths.common:container-maven-plugin:1.2.1:dis
t (build-distributions) on project pmDist: Unable to create distribution: Could
not resolve artifact: com.dsths.awdprovidermatching:pmConfig:jar:default-externa
l-jetty:1.0.2-SNAPSHOT:COMPILE -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception

作为引用,这里是 pmConfig 模块的 pom 文件:

<?xml version="1.0" encoding="UTF-8"?>

<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>

    <artifactId>pmConfig</artifactId>
    <name>${project.artifactId}</name>
    <packaging>pom</packaging>
    <parent>
        <groupId>com.dsths.awdprovidermatching</groupId>
        <artifactId>AWDProviderMatching</artifactId>
        <version>1.0.2-SNAPSHOT</version>
    </parent>
    <description>A POM-based project for filtering and collecting the various configurations for AWDProviderMatching.</description>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>

                    <execution>
                        <id>dev-localhost-make-assembly</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/generated-resources/dev-localhost</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/src/main/assembly</directory>
                                    <includes>
                                        <include>*.xml</include>
                                    </includes>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                            <filters>
                                <filter>${project.basedir}/src/main/filters/default.properties</filter>
                                <filter>${project.basedir}/src/main/filters/hostenv/localhost.properties</filter>
                                <filter>${project.basedir}/src/main/filters/appenv/dev.properties</filter>
                            </filters>
                            <overwrite>true</overwrite>
                        </configuration>
                    </execution>

                    <execution>
                        <id>turnkey-external-make-assembly</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/generated-resources/turnkey-external</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/src/main/assembly</directory>
                                    <includes>
                                        <include>*.xml</include>
                                    </includes>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                            <filters>
                                <filter>${project.basedir}/src/main/filters/default.properties</filter>
                                <filter>${project.basedir}/src/main/filters/hostenv/external.properties</filter>
                                <filter>${project.basedir}/src/main/filters/appenv/turnkey.properties</filter>
                            </filters>
                            <overwrite>true</overwrite>
                        </configuration>
                    </execution>


                    <execution>
                        <id>vcloud-vcloud-make-assembly</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/generated-resources/vcloud-vcloud</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/src/main/assembly</directory>
                                    <includes>
                                        <include>*.xml</include>
                                    </includes>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                            <filters>
                                <filter>${project.basedir}/src/main/filters/default.properties</filter>
                                <filter>${project.basedir}/src/main/filters/hostenv/vcloud.properties</filter>
                                <filter>${project.basedir}/src/main/filters/appenv/vcloud.properties</filter>
                            </filters>
                            <overwrite>true</overwrite>
                        </configuration>
                    </execution>

                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>dev-localhost-zip</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>${project.build.directory}/generated-resources/dev-localhost/template-zip-assembly.xml</descriptor>
                            </descriptors>
                            <filters>
                                <filter>${project.basedir}/src/main/filters/default.properties</filter>
                                <filter>${project.basedir}/src/main/filters/hostenv/localhost.properties</filter>
                                <filter>${project.basedir}/src/main/filters/appenv/dev.properties</filter>
                            </filters>
                        </configuration>
                    </execution>
                    <execution>
                        <id>dev-localhost-jboss-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>${project.build.directory}/generated-resources/dev-localhost/template-jboss-jar-assembly.xml</descriptor>
                            </descriptors>
                            <filters>
                                <filter>${project.basedir}/src/main/filters/default.properties</filter>
                                <filter>${project.basedir}/src/main/filters/hostenv/localhost.properties</filter>
                                <filter>${project.basedir}/src/main/filters/appenv/dev.properties</filter>
                            </filters>
                        </configuration>
                    </execution>
                    <execution>
                        <id>dev-localhost-jetty-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>${project.build.directory}/generated-resources/dev-localhost/template-jetty-jar-assembly.xml</descriptor>
                            </descriptors>
                            <filters>
                                <filter>${project.basedir}/src/main/filters/default.properties</filter>
                                <filter>${project.basedir}/src/main/filters/hostenv/localhost.properties</filter>
                                <filter>${project.basedir}/src/main/filters/appenv/dev.properties</filter>
                            </filters>
                        </configuration>
                    </execution>
                    <execution>
                        <id>vcloud-jetty-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>${project.build.directory}/generated-resources/vcloud-vcloud/template-jetty-jar-assembly.xml</descriptor>
                            </descriptors>
                            <filters>
                                <filter>${project.basedir}/src/main/filters/default.properties</filter>
                                <filter>${project.basedir}/src/main/filters/hostenv/vcloud.properties</filter>
                                <filter>${project.basedir}/src/main/filters/appenv/vcloud.properties</filter>
                            </filters>
                        </configuration>
                    </execution>
                    <execution>
                        <id>default-jetty-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>${project.build.directory}/generated-resources/turnkey-external/template-jetty-jar-assembly.xml</descriptor>
                            </descriptors>
                            <filters>
                                <filter>${project.basedir}/src/main/filters/default.properties</filter>
                                <filter>${project.basedir}/src/main/filters/hostenv/external.properties</filter>
                                <filter>${project.basedir}/src/main/filters/appenv/turnkey.properties</filter>
                            </filters>
                        </configuration>
                    </execution>

                    <execution>
                        <id>mdwise-properties-conf-zip</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>${project.basedir}/src/main/assembly/template-zip-assembly-properties-mdwise.xml</descriptor>
                            </descriptors>

                        </configuration>
                    </execution>

                    <execution>
                        <id>dbscripts-zip</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>${project.basedir}/src/main/assembly/template-zip-assembly-dbscripts.xml</descriptor>
                            </descriptors>

                        </configuration>
                    </execution>

                </executions>
            </plugin>
        </plugins>
    </build>
</project>

以下是失败模块的pom文件:

<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">
  <parent>
    <groupId>com.dsths.awdprovidermatching</groupId>
    <artifactId>AWDProviderMatching</artifactId>
    <version>1.0.2-SNAPSHOT</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>pmDist</artifactId>
  <!-- using POM packaging since all artifacts are produced by the container-maven-plugin plugin -->
  <packaging>pom</packaging>

  <dependencies>
    <!-- 
       Dependencies listed here are not used in the build.  They only exist to force maven to
       build the dependent projects before this one.  You only need to add your project's war
       module and the configuration module. If your project produces multiple WAR files, they 
       should both be included.
    -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>${war.artifactId}</artifactId>
      <version>${project.version}</version>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>${config.artifactId}</artifactId>
      <version>${project.version}</version>
      <classifier>${config.classifier}</classifier>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>com.dsths.common</groupId>
        <artifactId>container-maven-plugin</artifactId>
        <version>${dstcontainer.version}</version>
        <executions>
          <execution>
            <id>build-distributions</id>
            <phase>package</phase>
            <goals><goal>dist</goal></goals>
          </execution>
        </executions>
        <configuration>
          <artifacts>
            <!-- configuration artifact -->
            <artifact>
              <groupId>${project.groupId}</groupId>
              <artifactId>${config.artifactId}</artifactId>
              <version>${project.version}</version>
              <classifier>${config.classifier}</classifier>
              <unpack>true</unpack>
              <targetDir>conf</targetDir>
            </artifact>
            <!-- war artifact -->
            <artifact>
              <groupId>${project.groupId}</groupId>
              <artifactId>${war.artifactId}</artifactId>
              <version>${project.version}</version>
              <type>war</type>
              <targetDir>deploy/tenanted</targetDir>
            </artifact>
          </artifacts>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <properties>
    <config.artifactId>pmConfig</config.artifactId>
    <config.classifier>default-external-jetty</config.classifier>
    <war.artifactId>pmWeb</war.artifactId>
  </properties>

</project>

最佳答案

这是由于您的 Maven 版本所致。您需要降级到 Maven 3.0.5,它就能正常工作。

来源:我在同一个地方工作:)

关于java - 无法使用 Maven 解决 Artifact 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30527970/

相关文章:

java - 使用 Apache POI 刷新数据透视表

maven - 如何在 URL 中没有用户名和密码的情况下从我自己经过身份验证的关系中获取 Maven 原型(prototype)?

java - 具有远程业务接口(interface)和客户端应用程序的 EJB

java - 更改maven中的模块名称

jakarta-ee - WebSphere Application Server 8.5 上的 SRVE0200E 错误

java - 您如何在您的 Web 应用程序中实现客户特定的差异?

java - 如何从sql日期获取月份并使用Hibernate Criteria检查月份是否等于传递参数月份

java - 不可变类的存储区域

java - 向 SOAP 消息添加内容(基本)

java - 错误和构建失败 : When executing tests with karma