mvn package fails with Required Artifact Missing even though it exists in my Remote Repository

Henrique Ordine picture Henrique Ordine · Jun 14, 2012 · Viewed 11.3k times · Source

I'm trying to run mvn clean package on my Maven project and it fails with the message:

"required artifact is missing" for the artifact net.ezswitch:ResourcesComponent:jar:0.0.14

I've configured my settings.xml to include my Remote Repository and if I navigate, on my browser, I can actually find this Jar in my repository, but Maven can't, somehow.

I've checked that the Maven version that I'm running is the one for which the settings.xml file that I've edited takes effect, because if I disable the Profile that I configured there, Maven fails with a different message.

I'm using Maven 2.2.1 on MAC OS X Lion.

Here's my settings.xml:

<localRepository>/Users/hordine/.m2/repository</localRepository>
<servers>
  <server>
      <id>LiquixRepository</id>
      <username>henrique</username>
      <password>xxxxx</password>
      <configuration>
          <httpConfiguration>
              <put>
                  <params>
                      <param>
                          <name>http.authentication.preemptive</name>
                          <value>%b,true</value>
                      </param>
                  </params>
              </put>
          </httpConfiguration>      
      </configuration>
  </server>

  <server>
      <id>dev.liquix.eu</id>
      <username>henrique</username>
      <password>xxxxx</password>
  </server>
  <server>
      <id>ezpay-dev.liquix.eu</id>
      <username>henrique</username>
      <password>xxxxx</password>
  </server>
</servers>
<profiles>
  <profile>
      <id>ezswitch</id>

      <properties>
          <tomcat.home>/System/Library/tomcat</tomcat.home>
          <subversion.user>henrique</subversion.user>
          <subversion.password>xxxxx</subversion.password>
      </properties>

      <activation>
          <jdk>1.6</jdk>
      </activation>

      <repositories>
          <repository>
              <id>central</id>
              <name>EzSwitch Cache</name>
              <layout>default</layout>
              <url>http://ezpay-dev.liquix.eu:9998/repository</url>
          </repository>
          <repository>
            <id>central_maven1</id>
            <name>EzSwitch Cache2</name>
            <layout>legacy</layout>
            <url>http://ezpay-dev.liquix.eu:9998/repository</url>
          </repository>
      </repositories>


      <pluginRepositories>
          <pluginRepository>
              <id>central</id>
              <name>EZswitch</name>
              <url>http://ezpay-dev.liquix.eu:9998/repository</url>
              <snapshots>
              </snapshots>
              <releases>
              </releases>
          </pluginRepository>
      </pluginRepositories>

  </profile>
</profiles>
<activeProfiles>
    <activeProfile>ezswitch</activeProfile>
</activeProfiles>

And the entire error message that I get is:

[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Missing:
----------
1) net.ezswitch:ResourcesComponent:jar:0.0.14

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=net.ezswitch -DartifactId=ResourcesComponent -Dversion=0.0.14 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=net.ezswitch -DartifactId=ResourcesComponent -Dversion=0.0.14 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
    1) eu.liquix:RegistrationSolution:war:0.4.60-SNAPSHOT
    2) net.ezswitch:ResourcesComponent:jar:0.0.14

----------
1 required artifact is missing.

for artifact: 
  eu.liquix:RegistrationSolution:war:0.4.60-SNAPSHOT

from the specified remote repositories:
  central (http://ezpay-dev.liquix.eu:9998/repository),
  central_maven1 (http://ezpay-dev.liquix.eu:9998/repository)


    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:711)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

But if I navigate, via my browser, to that Location, I can see the Artifact at the following location:

http://ezpay-dev.liquix.eu:9998/repository/net/ezswitch/ResourcesComponent/0.0.14/ResourcesComponent-0.0.14.jar

I'd be grateful for any help. Thanks in advance.

Henrique Ordine

Answer

eis picture eis · Jun 19, 2012

Apparently error message "required artifact is missing" was hiding the actual root cause, which was not visible in the message(s). Running Maven with debug messages on (-X option) will print out additional information that gives more detailed insight as to what would be the problem.

For future reference, this time the error was

[WARNING] Unable to get resource 'net.ezswitch:ResourcesComponent:pom:0.0.14' from repository central (ezpay-dev.liquix.eu:9998/repository):
Specified destination directory cannot be created: /Users/hordine/.m2/repository/net/ezswitch/ResourcesComponent/0.0.14

Which wasn't visible without the debug flag.