m2eclipse compilation failure - maven

When I'm running "mvn site" from command line (using far manageR) everything works just excellent, it downloads all the necessary jars to repository and executes tasks.
But when I'm trying to do the same (mvn site) from eclipse using m2eclipse plugin it show me:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building jdbc_maven 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # jdbc_maven ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) # jdbc_maven ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to G:\workspace\jdbc_maven\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcRoleDao.java:[8,23] error: package org.apache.log4j does not exist
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcRoleDao.java:[13,16] error: cannot find symbol
[ERROR] symbol: class Logger
location: class JdbcRoleDao
G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\User.java:[5,23] error: package org.apache.log4j does not exist
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\User.java:[28,16] error: cannot find symbol
[ERROR] symbol: class Logger
location: class User
G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcUserDao.java:[13,23] error: package org.apache.log4j does not exist
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcUserDao.java:[19,16] error: cannot find symbol
[ERROR] symbol: class Logger
location: class JdbcUserDao
G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcRoleDao.java:[13,29] error: cannot find symbol
[ERROR] symbol: variable Logger
location: class JdbcRoleDao
G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\User.java:[28,29] error: cannot find symbol
[ERROR] symbol: variable Logger
location: class User
G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcUserDao.java:[19,29] error: cannot find symbol
[INFO] 9 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.387s
[INFO] Finished at: Sat Feb 16 11:05:13 EET 2013
[INFO] Final Memory: 7M/154M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project jdbc_maven: Compilation failure: Compilation failure:
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcRoleDao.java:[8,23] error: package org.apache.log4j does not exist
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcRoleDao.java:[13,16] error: cannot find symbol
[ERROR] symbol: class Logger
[ERROR] location: class JdbcRoleDao
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\User.java:[5,23] error: package org.apache.log4j does not exist
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\User.java:[28,16] error: cannot find symbol
[ERROR] symbol: class Logger
[ERROR] location: class User
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcUserDao.java:[13,23] error: package org.apache.log4j does not exist
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcUserDao.java:[19,16] error: cannot find symbol
[ERROR] symbol: class Logger
[ERROR] location: class JdbcUserDao
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcRoleDao.java:[13,29] error: cannot find symbol
[ERROR] symbol: variable Logger
[ERROR] location: class JdbcRoleDao
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\User.java:[28,29] error: cannot find symbol
[ERROR] symbol: variable Logger
[ERROR] location: class User
[ERROR] G:\workspace\jdbc_maven\src\main\java\com\nixsolutions\JdbcUserDao.java:[19,29] error: cannot find symbol
Here is my 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jdbc_maven</groupId>
<artifactId>jdbc_maven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>jdbc_maven</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.4.8</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.169</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.6</version>
<configuration>
<configLocation>sun_checks.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.6.1</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
<!-- JDK 1.7 COMPILER - DON'T TOUCH -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<executable>${env.JAVA_HOME}/bin/javac</executable>
<fork>true</fork>
</configuration>
</plugin>
<!-- JDK 1.7 COMPILER - DON'T TOUCH -->
</plugins>
</build>
</project>

This sometimes happen with m2eclipse , its because as you add new dependencies to the pom.xml , m2e will automatically add it to classpath and this classpath generation has some issue.
well a quick and dirty way to fix would be to
Remove the project from the eclipse
Now navigate to the project folder and delete .settings directory and .classpath file
Import the project into the eclipse as a 'Maven Project'

Do project->clean (also try to refresh the project) in eclipse. When you compile your code from command line it sometimes causes some issue in eclipse and the code has to be recompiled in eclipse

Everyone who's using m2eclipse plugin and strugling some proglems, here are my tips:
1) user your own maven, not build in m2eclipse, you can switch to it in m2eclipse preferences
2) change repository location from the foolish one C:\Users\current_user-m2\repository
to D:\repository or to any other normal path without ~ or any other special liters
3) check everything in console with your own maven before panic. For example my commands like
mvn site
mvn install
mvn tomcat:redeploy
work EXCELLENT from console, but fail from inside eclipse. That means m2eclipse parameters are wrong and you should set your own parameters.
4) don't rely on context commands (right click - run as - maven test / site / build)
create your own command in run as - maven build - in menu choose the correct version of JRE (1.7 in my case) and add any additional parameters don't forget to give this command your name like: "maven tomcat:redeploy JDK 7" - that will give you a good chance to run whatever you want and don't face 90% of m2eclipse problems and bugs.
P.S. I was struggling maven 2 and m2eclipse for more than 20 hours. Hope my tips will be userful for some one.

I had the same problem and I think I have found the solution. The problem is that under run configurations, the maven configuration for your project doesn't have refreshed the new settings made in the overall configuration.
Here is my solution:
in the run button (the one with a green triangle), select run configurations
move into the categories to the "maven build" category and look for the one of your project
checkout that the maven runtime, JRE, and things like that are configured properly: these values aren't refreshed when changed in eclipse
apply changes and run
This solution have worked for me (I have been playing with the value maven runtime, changing between embedded and external and that seemed to be the problem.

same problem when generate docs using m2eclipse, goal javadoc:javadoc or javadoc:jar, meanwhile Project -> Generate Javadoc works fine. It's seem problem in wrong classpath in first case.
Workaround:
1.run Project -> Generate Javadoc with check option "Save the settings ofthe Javadoc export as an antscript"
2. javadoc.xml will be generated
3. run m2eclipse, after failure javadoc.sh, options, packages will be in /site/apidocs/
4. take content of classpath from javadoc.xml and put in classpath in options file
5. run ./javadoc.sh

in pom.xml make sure you have the log4j scope at compile
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
<version>2.5</version>
<scope>compile</scope>
</dependency>
It still puts the log4j.jars into the .war.

Related

Error executing selenium scripts through maven

I am getting the following error when executing 'install' command for maven
**[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) # com.amazon.hybrid ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 6 source files to G:\My Learnings\Framework\target\test-classes
[INFO] -------------------------------------------------------------**
**[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error**
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.483s
[INFO] Finished at: Thu Jun 22 23:27:00 IST 2017
[INFO] Final Memory: 9M/153M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:testCompile (default-testCompile) on project com.amazon.hybrid: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Below is my pom.xml structure
<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.amazon.hybrid</groupId>
<artifactId>com.amazon.hybrid</artifactId>
<version>0.0.1-SNAPSHOT</version>
<description>This is used to order items from Amazon.in</description>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.0.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.14</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.14</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<compilerVersion>1.8</compilerVersion>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
Note:
I have changed the environment from JRE to JDK by Window -> Preferences -> Java -> Installed JREs -> Added JDK and selected JDK
2. Updated Project
Even after doing the previous steps, the issue remains unresolved.
Any help in solving the issue is appreciated.
Regards,
ANUP J
You are using very old versions of almost everything present in your pom.xml
you can download the latest versions from here ---> Maven repository link to get latest dependencies
I'm mentioning few of them :
Selenium
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
TestNG
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
</dependency>
Similarly, you can find rest of the dependencies from the above given link.
Let me know if it helps. :)

unable to change junit version from 3.8.1 to 4.11 using maven on eclipse kepler

i created a simple maven java project on eclipse kepler.
I wrote a simple JUnit (version 4) test. I can run it from Eclipse, but not from the pom.xml (alt-click, Run as, Maven Test). I suppose I need to tell Maven to search for that class, but I just don't know how.
with default junit version 3.8.1, mvn test works fine but failing on only eclipse when changed to 4.11. this worked on command promt.
my 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.seleniumsimplified.webdriver</groupId>
<artifactId>webdriverbasics</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>webdriverbasics</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
error :
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.10/surefire-junit4-2.10.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.819s
[INFO] Finished at: Tue Feb 02 19:25:36 IST 2016
[INFO] Final Memory: 12M/210M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project webdriverbasics: Unable to generate classpath: org.apache.maven.artifact.resolver.ArtifactResolutionException: Unable to get dependency information for org.apache.maven.surefire:surefire-junit4:jar:2.10: Failed to retrieve POM for org.apache.maven.surefire:surefire-junit4:jar:2.10: Could not transfer artifact org.apache.maven.surefire:surefire-junit4:pom:2.10 from/to central (http://repo.maven.apache.org/maven2): null to http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.10/surefire-junit4-2.10.pom
[ERROR] org.apache.maven.surefire:surefire-junit4:jar:2.10
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false)
[ERROR] Path to dependency:
[ERROR] 1) dummy:dummy:jar:1.0: UnresolvedAddressException
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
workarounds that i tried :
1) tried adding <build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
2) changed test file name from AppTest.java to TestApp.java
3) commented <scope>test</test>
4) selected Upgrade Maven project
but nothing is helping. i am new to Maven.
please guide. thanks in advance :)
By definition
pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except that rather than configuring plugin information for this particular project build, it is intended to configure project builds that inherit from this one.
But you need to configure plug-in in current project, so
<project ...
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.18.1</version>
</dependency>
</dependencies>
</plugin>
...
</plugins>
...
<build>
</project>
Specifying the version for surefire-junit is not required - maven has some rules around it, but I prefer the clarity.
You still need a <scope>test</test> for junit dependency though.

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile in Spring

I am working on a Spring security project in STS. I am trying to build my project but I am getting the following exception.
Error log,
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.288 s
[INFO] Finished at: 2015-11-27T09:41:59+05:30
[INFO] Final Memory: 21M/227M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project spring-data-rest-security: Fatal error compiling: invalid target release: 1.8 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
My pom.xml file is
<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>
<artifactId>spring-data-rest-security</artifactId>
<name>Spring Data REST - Security Example</name>
<parent>
<groupId>org.springframework.data.examples</groupId>
<artifactId>spring-data-rest-examples</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
</parent>
<properties>
<spring-security.version>4.0.2.RELEASE</spring-security.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
</dependency>
</dependencies>
</project>
I read answers of similar issues but none of them seem to work. Kindly help me out.
Do this in your cmd line C:\mvn>echo %JAVA_HOME% if the output is something like C:\Program Files\Java\jdk1.X... where X is anything but number 8, then you are trying to build it with wrong jdk version.
Install jdk 1.8 and make sure your %JAVA_HOME points to that or drop the target release to 1.X.
That would not help. I had the same issues and my %JAVA_HOME% pointed to jdk1.8.0_45. I also had java version 1.8 language version 8 in IntelliJ "Project Settings >> Build, Execution, Deploy >> Module Compiler Version" and "Project Structure >> Modules >> Source". However this did not fix my issue.
As per this apache resource, it looks like that default source setting after Maven 3.0 is 1.5 that needs a manual override using pom.xml. I explicitly provided source and targer release to 1.8 in my pom.xml and it DID fix my issue.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

Cannot download Maven Resources Plugin when building in Jenkins

I have created Selenium IDE test cases and have tested them in Eclipse. The project is a Maven java project and the tests will run fine in Eclipse however, when I add the project to Jenkins and try to build my project, there is a error and a build failure.
The error:
Started by user anonymous
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Selenium IDE Recon
Parsing POMs
Discovered a new module Test:SeleniumTest SeleniumTest
Modules changed, recalculating dependency graph
[Selenium IDE Recon] $ C:\java/bin/java -cp "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-agent-1.5.jar;C:\Users\MC44948\Software\springsource\springsource\apache-maven-3.0.4\boot\plexus-classworlds-2.4.jar" org.jvnet.hudson.maven3.agent.Maven3Main C:\Users\MC44948\Software\springsource\springsource\apache-maven-3.0.4 "C:\Program Files (x86)\Jenkins\war\WEB-INF\lib\remoting-2.45.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-1.5.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.5.jar" 53032
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f C:\Users\MC44948\Spring_Workspace\Selenium IDE Recon\pom.xml install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SeleniumTest 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.671s
[INFO] Finished at: Mon Sep 29 11:46:35 BST 2014
[INFO] Final Memory: 4M/8M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [Help 1]
[JENKINS] Archiving C:\Users\MC44948\Spring_Workspace\Selenium IDE Recon\pom.xml to Test/SeleniumTest/0.0.1-SNAPSHOT/SeleniumTest-0.0.1-SNAPSHOT.pom
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
channel stopped
Finished: FAILURE
My pom:
<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>Test</groupId>
<artifactId>SeleniumTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>SeleniumTest</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.43.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.opera</groupId>
<artifactId>operadriver</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>2.43.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.6.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.opera</groupId>
<artifactId>operadriver</artifactId>
<version>0.16</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
</project>
This seems to be related to Internet connectivity. Did you notice the error: "Unknown host repo.maven.apache.org"?
Try wget http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom and see if you can fetch data.
For more details, you can refer this link.
You can try also this...
My Java project was building successfully when building from command line, but I was getting an error "Unknown host repo.maven.apache.org" when building it with Jenkins.
The problem was is the custom maven settings file which our company was using.
So what you can do is: Under Job configuration, Build section, click "Advanced...".
Set the "Settings file" to "Settings file in filesystem" and give the path to the setting file from your maven installation location. For example
C:\Program Files\apache-maven-3.1.1\conf\settings.xml
Set the "Global Settings file" to "Global settings file on filesystem" and give the path to the "${user.home}/.m2/settings.xml".
You might be behind cooperate proxy (or any other proxy\firewall).
Make sure you can access maven central from the slave you're running your build.
If not - configure your http_proxy and https_proxy on your server.

maven compilation fails because unavailable dependency

I'm trying to run java program with maven but when i compiled using the command mvn -U compile
he shows me the following error
[root#onePK-EFT1 tutorials]# mvn -U compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building onePK Java Tutorials 0.6.0.5
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/com/cisco/onep/libonep-core-rel
/0.6.0.5/libonep-core-rel-0.6.0.5.pom
[WARNING] The POM for com.cisco.onep:libonep-core-rel:jar:0.6.0.5 is missing, no
dependency information available
Downloading: http://repo.maven.apache.org/maven2/com/cisco/onep/libonep-
core-rel/0.6.0.5/libonep-core-rel-0.6.0.5.jar
[INFO] ------------------------------------------------------------------------
INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.517s
[INFO] Finished at: Tue Jul 09 07:28:28 PDT 2013
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project java-tutorials: Could not resolve
dependencies for project com.cisco.onep:java-tutorials:jar:0.6.0.5: Could not find
artifact com.cisco.onep:libonep-core-rel:jar:0.6.0.5 in central
(http://repo.maven.apache.org/maven2) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read
the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN
/DependencyResolutionException
and 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.cisco.onep</groupId>
<artifactId>hello-network-app</artifactId>
<version>0.1-SNAPSHOT</version>
<name>The onePK Hello Network Example Application</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<forkMode>always</forkMode>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.cisco.onep</groupId>
<artifactId>libonep-core-rel</artifactId>
<version>0.6.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>0.6.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
</dependencies>
<developers>
<developer>
<name>onePK Team</name>
<email>onepk-feedback#cisco.com</email>
<organization>Cisco.com</organization>
</developer>
</developers>
I think it's because he can't find libonep-core-rel.jar which i have it included
please any help
The simple solution is to use the appropriate maven repository for the artifacts com.cisco.onep* which are not located in Maven central.
As an immediate solution, but not a recommendation, you can use system dependencies to resolve artifacts on your local filesystem.
As #khmarbaise implied, try to publish those corporate artifacts to your corporate Maven repository (Nexus, Artifactory, Archiva, etc.), even an FTP/HTTP server would do...
Once you publish those corporate artifacts to your "corporate" repository(hopefully it's already in place), you just need a new repository declaration in your Maven POM.

Resources