Solved

LifecycleExecutionException when running Maven2 compile goal of a Java project

Posted on 2006-11-30
8
1,636 Views
Last Modified: 2013-11-18
Hi,

   I am getting an error with a Maven 2.0.4 compile goal of a Java 1.5 project.  It has been built successfully before, just not by me and I am unable to figure out what is causing my issue.  The error I am receiving when I have trace enabled is "org.apache.maven.lifecycle.LifecycleExecutionException: The plugin 'org.apache.maven.plugins:maven-resources-plugin' does not exist or no valid version could be found".  I am using the default local repository of ~/.m2/repository and have my settings.xml there.  The settings file lists four repositories with a personal remote repository as the default.  The remote repository is actually on the same box but is referenced through a URL.  The remote and local repositories both contain the maven-resources-plugin, associated pom and sha1 hash files, for versions 2.1 and 2.2.  Also, metadata.xml files exist from each of the remote repos the settings file lists.  These metadata files contain current version information.  It's intriguing that several of them contain the active version as LATEST.  I was wondering if this was the problem so I created a LATEST directory in the maven2 repo structure and re-ran the build to no effect.  I also tried removing these metadata.xml files and still got the same error.  In fact, it seems to not find it in the local and my remote repos so it goes out to the other remote repos specified and attempts to download from each of them.  That's where the metadata.xml files come from.  So, they were just replaced when I removed them.  Lastly, I have tried commenting out various repository definitions in the settings.xml and pom.xml to no effect.  Below, I have included first) the log of the failure, second) the repos declared in the settings.xml, third) the pom.xml declaration, fourth) a sample of the metadata.xml files.  

Please help!  : )

//**********************************************   Log of build ***************************************
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ----------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [compile]
[INFO] ----------------------------------------------------------------------------
[INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking for updates from central
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-resources-plugin' does not exist or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: The plugin 'org.apache.maven.plugins:maven-resources-plugin' does not exist or no valid version could be found
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1281)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1517)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindLifecycleForPackaging(DefaultLifecycleExecutor.java:1011)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:975)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:453)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
      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:585)
      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)
Caused by: org.apache.maven.plugin.version.PluginVersionNotFoundException: The plugin 'org.apache.maven.plugins:maven-resources-plugin' does not exist or no valid version could be found
      at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:225)
      at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:87)
      at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:158)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1252)
      ... 18 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Nov 29 15:46:11 EST 2006
[INFO] Final Memory: 1M/2M
[INFO] ------------------------------------------------------------------------


//******************************************* settings.xml ***************************************
{Let me know if you need to see more of this file}

  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ~/.m2/repository

  <localRepository>http://my-remote-repository.com/maven2/</localRepository>
  -->

  <!-- interactiveMode
   | This will determine whether maven prompts you when it needs input. If set to false,
   | maven will use a sensible default value, perhaps based on some other setting, for
   | the parameter in question.
   |
   | Default: true
  <interactiveMode>true</interactiveMode>
  -->

  <!-- offline
   | Determines whether maven should attempt to connect to the network when executing a build.
   | This will have an effect on artifact downloads, artifact deployment, and others.
   |
   | Default: false
  <offline>false</offline>
  -->

  <!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |-->
  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net,some.host.com</nonProxyHosts>
    </proxy>
    -->
    <proxy>
      <id>proxy-1</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>my-remote-repository.com</host>
      <port>80</port>
      <nonProxyHosts>*.local-servers.com</nonProxyHosts>
    </proxy>
    <proxy>
      <id>proxy-2</id>
      <active>false</active>
      <protocol>http</protocol>
      <host>corp-proxy</host>
      <port>8080</port>
      <nonProxyHosts>*.local-servers.com</nonProxyHosts>
    </proxy>
   <proxy>
      <id>proxy-3</id>
      <active>false</active>
      <protocol>http</protocol>
      <host>corp-proxy2</host>
      <port>8080</port>
      <nonProxyHosts>*.local-servers.com</nonProxyHosts>
    </proxy>  
  </proxies>

//*************************************** pom.xml **************************************************
<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>
  <groupId>com.myapp</groupId>
  <artifactId>myapp-app</artifactId>
  <packaging>pom</packaging>
  <version>1.0</version>
  <name>myapp</name>
  <!-- $Id: pom.xml,v 1.4 2006/10/18 20:15:50 ME Exp $ -->

  <repositories>
    <repository>
      <id>my-central</id>
      <name>Maven 2 Repository</name>
      <layout>default</layout>
      <url>http://my-remote-repository.com/maven2</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <modules>
    <module>myapp-ejbs</module>
    <module>myapp-webapp</module>
    <module>myapp-ear</module>
  </modules>

  <dependencies>

    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.0.4</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>4.7</version>
      <scope>test</scope>
      <classifier>jdk15</classifier>
    </dependency>

  </dependencies>

</project>


//*********************************** Sample of metadata.xml files ************************************
{These can be seen from the remote repository urls listed above in the settings.xml file.  Just open in your browser, go to org -> apache -> maven -> plugins.}
<?xml version="1.0" encoding="UTF-8"?><metadata>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-resources-plugin</artifactId>
  <version>LATEST</version>
</metadata>

- OR -   {I'm seeing both of these types}

<?xml version="1.0"?><metadata>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-resources-plugin</artifactId>
  <versioning>
    <latest>2.2</latest>
    <release>2.2</release>
    <versions>
      <version>2.0-beta-1</version>
      <version>2.0-beta-2</version>
      <version>2.0</version>
      <version>2.1</version>
      <version>2.2</version>
    </versions>
    <lastUpdated>20060514041911</lastUpdated>
  </versioning>
</metadata>
0
Comment
Question by:CircularReference
  • 4
  • 2
8 Comments
 
LVL 5

Expert Comment

by:dasmaer
ID: 18045894
What version of Java do you have installed on the machine?

D
0
 

Author Comment

by:CircularReference
ID: 18045928
Java versions 1.4.2_10 and 1.5.0_06 are both installed.  1.5.0_06 is setup as the JAVA_HOME and path.
0
 

Author Comment

by:CircularReference
ID: 18046032
An update:  I realized that there are plugin repositories separate from the normal repository declaration in the settings.xml and pom.xml files.  I have the below plugin repositories declared in my settings.xml.  I have tried commenting them out (all in the settings.xml and pom.xml) and it prevents the metadata.xml files from being downloaded to my local repository as I mentioned above.  However, it does not fix the problem.  I have also tried to compile another maven 2 project that works successfully for others and I get the same issue locally.  I tried doing a maven help:describe goal and got the same error for the help plugin so this problem is for all plugins on my system.  I also discovered that the maven-resources-plugin is the first mojo (a Maven unit of work) in the compile goal that I'm executing.  The original command I was executing to get the error is "mvn -U -e compile" from the projects directory.  The -U and -e only tell Maven to be verbose and put it in trace mode.

thanks in advance for any help!


//************************** Plugin Repositories from settings.xml ******************************************
     <pluginRepositories>
       <pluginRepository>
          <id>maven.org-plugin</id>
          <name>Apache Plugin Repo</name>
          <url>http://repo1.maven.org/maven2/</url>
          <layout>default</layout>
          <snapshots>
             <enabled>true</enabled>
             <updatePolicy>never</updatePolicy>
          </snapshots>
       </pluginRepository>
       <pluginRepository>
          <id>lsu.edu-plugin</id>
          <name>LSU Plugin Repo</name>
          <url>http://ibiblio.lsu.edu/main/pub/packages/maven2</url>
          <layout>legacy</layout>
          <snapshots>
             <enabled>true</enabled>
             <updatePolicy>never</updatePolicy>
          </snapshots>
       </pluginRepository>
       <pluginRepository>
          <id>codehaus.org-plugin</id>
          <name>Codehaus Plugin Repository</name>
          <url>http://repository.codehaus.org/</url>
          <layout>legacy</layout>
          <snapshots>
             <enabled>true</enabled>
             <updatePolicy>never</updatePolicy>
          </snapshots>
       </pluginRepository>
     </pluginRepositories>
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 5

Expert Comment

by:dasmaer
ID: 18046143
Can you try compiling on a machine that only has 1 Java instance installed?

I had a pain once with Eclipse where my local app server was running a different Java to the IDE, it only got fixed when I removed the older Java. If that doesn't solve it then it sounds to me as more like a configuration issue than a compile issue (as in config is causing compile). The error:

The plugin 'org.apache.maven.plugins:maven-resources-plugin' does not exist or no valid version could be found

Sounds very much like the class isn't where it is expected to be, so check all the configuration files are pointing to the right class in your app.  Sorry its a bit vague but there is so much information to read through its hard to see the wood through the trees... my tip would be to try and isolate where the problem is, and then fingers crossed it'll become obvious (although I'm guessing you've been trying to isolate for a while).
0
 

Author Comment

by:CircularReference
ID: 18046218
Thanks Dasmaer.  I'll try your suggestions.  I apologize for the length of the information but as you mention, I've been trying to narrow the problem down for awhile.  
0
 

Author Comment

by:CircularReference
ID: 18048208
Well, it wasn't the other java instance and the configuration files were pointing to the right class.  However, I was able to track down the problem.  The problem had to do with the proxy settings.  Maven is constantly accessing the web to check online repositories and it must have been checking the web even though I had the plugin local and had specified the local repository and my remote repository as the defaults.  When it went to check the web, it encountered a problem with the proxy and gave the above somewhat misleading error.  When I removed the proxy setting, the project built successfully.  You would think I could tell it not to attempt to check the central repository but it seems to check it regardless of my settings.

Thanks for trying to help dasmaer!
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 18368406
PAQed with points refunded (300)

DarthMod
Community Support Moderator
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now