1

This is working well on Windows, but not on Linux and I don't know what I'm doing wrong here.

After I go to my maven project directory, the one that contains the POM.xml file, and "mvn package -e" it, here is the console output:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building functionalTests
[INFO]    task-segment: [package]
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/eclipse/m2e/lifecycle-mapping/1.0.0/lifecycle-mapping-1.0.0.pom
[INFO] Unable to find resource 'org.eclipse.m2e:lifecycle-mapping:pom:1.0.0' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/eclipse/m2e/lifecycle-mapping/1.0.0/lifecycle-mapping-1.0.0.pom
[INFO] Unable to find resource 'org.eclipse.m2e:lifecycle-mapping:pom:1.0.0' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: org.eclipse.m2e:lifecycle-mapping

Reason: POM 'org.eclipse.m2e:lifecycle-mapping' not found in repository: Unable to download the artifact from any repository

  org.eclipse.m2e:lifecycle-mapping:pom:1.0.0

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)

 for project org.eclipse.m2e:lifecycle-mapping


[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Unable to build project for plugin 'org.eclipse.m2e:lifecycle-mapping': POM 'org.eclipse.m2e:lifecycle-mapping' not found in repository: Unable to download the artifact from any repository

  org.eclipse.m2e:lifecycle-mapping:pom:1.0.0

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)

 for project org.eclipse.m2e:lifecycle-mapping
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1557)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindPluginToLifecycle(DefaultLifecycleExecutor.java:1503)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:1282)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:534)
    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:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    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.InvalidPluginException: Unable to build project for plugin 'org.eclipse.m2e:lifecycle-mapping': POM 'org.eclipse.m2e:lifecycle-mapping' not found in repository: Unable to download the artifact from any repository

  org.eclipse.m2e:lifecycle-mapping:pom:1.0.0

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)

 for project org.eclipse.m2e:lifecycle-mapping
    at org.apache.maven.plugin.DefaultPluginManager.checkRequiredMavenVersion(DefaultPluginManager.java:293)
    at org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:205)
    at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:184)
    at org.apache.maven.plugin.DefaultPluginManager.loadPluginDescriptor(DefaultPluginManager.java:1642)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1540)
    ... 18 more
Caused by: org.apache.maven.project.ProjectBuildingException: POM 'org.eclipse.m2e:lifecycle-mapping' not found in repository: Unable to download the artifact from any repository

  org.eclipse.m2e:lifecycle-mapping:pom:1.0.0

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)

 for project org.eclipse.m2e:lifecycle-mapping
    at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:605)
    at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:251)
    at org.apache.maven.plugin.DefaultPluginManager.checkRequiredMavenVersion(DefaultPluginManager.java:277)
    ... 22 more
Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the artifact from any repository

  org.eclipse.m2e:lifecycle-mapping:pom:1.0.0

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)


    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:228)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
    at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:558)
    ... 24 more
Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to download the artifact from any repository
    at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:404)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)
    ... 26 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Wed Sep 04 12:38:23 EEST 2013
[INFO] Final Memory: 4M/15M

This is my pom.xml file

<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">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.pragmaticqa.tests</groupId>
    <artifactId>mailCheckerTest</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>functionalTests</name>
    <url>http://maven.apache.org</url>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <displayProps>target/selenium/display.properties</displayProps>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-firefox-driver</artifactId>
            <version>2.33.0</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.7</version>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.33.0</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire</artifactId>
            <version>2.5</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>net.sf.opencsv</groupId>
            <artifactId>opencsv</artifactId>
            <version>2.3</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>aspectj-maven-plugin</artifactId>
                                    <versionRange>[1.0,)</versionRange>
                                </pluginExecutionFilter>
                                <action>
                                    <execute />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>selenium-maven-plugin</artifactId>
                <version>2.3</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <includes>
                        <include>**/*Test*.java</include>
                    </includes>
                    <systemPropertyVariables>
                    </systemPropertyVariables>
                </configuration>
                <executions>
                    <execution>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

And this is the output of "mvn -version"

Apache Maven 2.2.1 (rdebian-1)
Java version: 1.6.0_27
Java home: /usr/lib/jvm/java-6-openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.32-45-generic" arch: "i386" Family: "unix"
eddie
  • 1,252
  • 3
  • 15
  • 20
Kaloyan Roussev
  • 14,515
  • 21
  • 98
  • 180

2 Answers2

2

The root cause of your problem is the non-existing plugin lifecycle-mapping

Unable to download the artifact from any repository org.eclipse.m2e:lifecycle-mapping:pom:1.0.0

The solution to your problem is here: m2e lifecycle-mapping not found

EDIT

Suggestion to avoid using m2eclipse:

Define the plugin lifecycle-mapping in a dev profile and activate this profile only in eclipse. So when you will run it on your CI-Server (without the dev profile): the plugin won't be implied.

Add this to your pom.xml:

<profiles>
<profile>
  <id>dev</id>
  <build>
    <plugins>
      <plugin>
            <groupId>org.eclipse.m2e</groupId>
            <artifactId>lifecycle-mapping</artifactId>
            <version>1.0.0</version>
            <configuration>
                <lifecycleMappingMetadata>
                    <pluginExecutions>
                        <pluginExecution>
                            <pluginExecutionFilter>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>aspectj-maven-plugin</artifactId>
                                <versionRange>[1.0,)</versionRange>
                            </pluginExecutionFilter>
                            <action>
                                <execute />
                            </action>
                        </pluginExecution>
                    </pluginExecutions>
                </lifecycleMappingMetadata>
            </configuration>
    </plugin>
  </plugins>
</plugin>
</build>
</profile>
</profiles>

You also need to remove the plugin from your default build section.

The dev profile won't be active by default, so the plugin won't run by default.

To run the build with the plugin you need to activate the profile. There are different way of doing this:

  • adding -Pdev to mvn command line
  • find a way under eclipse to activate a profile (no idea how to it, I'm not an eclipse user)
  • make the dev profile active by default in settings.xml (under $USER_HOME/.m2/settings.xml - if this file don't exists: create it by hand): this useful to activate the dev profile on a developer machine.

To do it, add the following line in settings.xml

 <settings>
  ...
  <activeProfiles>
    <activeProfile>dev</activeProfile>
  </activeProfiles>
</settings> 

Note : for the last solution, you must ensure that the maven installation used by eclipse will use this settings.xml (once again, I'm not an eclipse user... so I don't know how to ensure that)

Community
  • 1
  • 1
ben75
  • 29,217
  • 10
  • 88
  • 134
0

run mvn eclipse:eclipse from your project directory, this should resolve your m2e lifecycle plugin error.

Vaibhav
  • 397
  • 2
  • 10