无法使用Maven解决工件错误

时间:2015-05-29 11:06:06

标签: java maven java-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>

2 个答案:

答案 0 :(得分:1)

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

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

答案 1 :(得分:0)

您在pom(显式或非显式)中指定了对具有id pmConfig和groupId com.dsths.awdprovidermatching的工件的依赖项。它无法在您的任何存储库中找到(无论是本地还是远程)。

如果你向我们展示了pom或maven依赖树,我们甚至可以指出这个工件的使用位置。

这表示您正在编译的模块可能取决于所提到的技术。如果我猜对了,那就是你正在开发的那个。在这种情况下,您需要先编译一个。