简体   繁体   中英

Could not resolve artifact error with Maven

When I build a module using Maven, I get the following error: Can anyone please let me know what this error means exactly?

[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

For reference, here is the pom file of pmConfig module:

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

The below is the pom file of the failing module:

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

This is due to your Maven version. You need to downgrade to Maven 3.0.5 and it will work fine.

Source: I work at the same place :)

You specified somewhere in your pom (explicitly or not) a dependency on the artifact with the id pmConfig and groupId com.dsths.awdprovidermatching. It cannot be found in any of your repositories (be it local or remote).

If you show us the pom or maven dependency tree we may even pintpoint where this artifact is being used.

This indicates that the module you are compiling may depend upon the mentioned artificat. Which, if my guess is right is one you are developing. In this case you need to compile that one first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM