5

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

thSoft
  • 21,755
  • 5
  • 88
  • 103
Henrique Ordine
  • 3,337
  • 4
  • 44
  • 70
  • it would look like it's some custom component. are you sure that component has the correct pom there, and it is using correct packaging? has it ever worked any any computer? how has it been installed? does maven have connectivity to the server? have you tried running maven in debug mode to see any detailed info? – eis Jun 18 '12 at 16:43
  • Yes, it has connectivity with the server, otherwise it would fail with a different exception? It works in all my colleagues'computers. The POM and Jar files are there. I'll post what the POM file says tomorrow. What do you mean in debug mode? with the -e option? – Henrique Ordine Jun 18 '12 at 19:38
  • 1
    Ok, if it works for others, that definitely rules out any POM issue. I meant -X option. – eis Jun 18 '12 at 19:44
  • Excellent! When I turned -X on, I'd get the warning: [WARNING] Unable to get resource 'net.ezswitch:ResourcesComponent:pom:0.0.14' from repository central (http://ezpay-dev.liquix.eu:9998/repository): Specified destination directory cannot be created: /Users/hordine/.m2/repository/net/ezswitch/ResourcesComponent/0.0.14 just before it failed with a "ResourceDoesNotExistException: Unable to locate resource in repository" for that component. I changed the permissions of my local repository to Read&Write for Everyone, and I don't get the error anymore. – Henrique Ordine Jun 19 '12 at 07:12
  • Thanks so much, Eis. Would you like to create an answer so that I can select it as a correct one? – Henrique Ordine Jun 19 '12 at 07:12
  • Great that it helped :) Done as requested. – eis Jun 19 '12 at 09:11

3 Answers3

4

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.

eis
  • 51,991
  • 13
  • 150
  • 199
1

If you haven't already, could you please try:

mvn -U clean package

In addition updating all snapshot versions, in case they have been newly deployed to the repository since Maven's once a day snapshot check, this will also force Maven to update its other cached repo resolutions, such as 404's.

Chris Beach
  • 4,302
  • 2
  • 31
  • 50
  • The missing artifact is a release version not a snapshot. Isn't the -U only for snapshot checking? – chad Jun 15 '12 at 19:10
  • -U does refresh -SNAPSHOTS, but not just -SNAPSHOTs. Maven caches resolution failures to avoid hammering servers. The -U forces it to retry a failed download. – Chris Beach Jun 15 '12 at 21:11
  • @Chris Beach Thanks for your effort. I tried that, but it still fails with a Missing Artifact error. – Henrique Ordine Jun 18 '12 at 11:20
1

Just had this problem. Went through so many solutions on my Mac. In the end changed my

~/.m2/settings.xml

changed this:

 <localRepository>${USER.HOME}/.m2/repository</localRepository>

to this:

 <localRepository>${env.HOME}/.m2/repository</localRepository>

you can see all the properties you have to play with on a mac by typing in a terminal

 export
Blundell
  • 75,855
  • 30
  • 208
  • 233