I am trying to setup Jenkins to automate project builds and I ran to the following problem. mvn clean install works perfectly from cmd but project build from jenkins fails when maven-antrun-plugin is being used.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run
(clientgen) on project Sample:
An Ant BuildException has occured: Compile failed; see the compiler error output for
details.
[ERROR] around Ant part ...<javac fork="yes" memoryInitialSize="512m"
destdir="E:\Jenkins\workspace\Trunk Builds\Sample\target/generated-sources"
memoryMaximumSize="1024m" srcdir="E:\Jenkins\workspace\Trunk Builds\Sample\target/build"
source="1.4" classpathref="maven.plugin.classpath" executable="C:\j2sdk1.4.2_19/bin/javac"
target="1.4"/>... # 46:428 in
E:\Jenkins\workspace\Trunk Builds\Sample\target\antrun\build-main.xml
Jenkins is actually unable to check for the packages imported when I use maven-antrun-plugin.
[javac] E:/Jenkins/workspace/Trunk Builds/Sample/target/build/ClassSample.java:20:
package org.sample.package does not exist
Whenever I do not use maven-antrun-plugin Jenkin build succeeds. Any ideas why even though it works through cmd jenkins fail to build the project?
Actually I found the real problem and found a workaround. The problem is that Jenkins did not access .m2/repository for some reason so I configured Jenkins to use local to workspace repository. Now it builds normally.
Related
I have a maven project and try to do a maven install.While performing the maven install, Im getting the below error.
[INFO] Compiling 403 source files to D:\\iTT_Backend\itt\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/iTT_Backend/itt/src/main/java/com/iowe/bean/Project.java:[5,27]
package com.cx.util does not exist
[ERROR]
/D:/iTT_Backend/itt/src/main/java/com/itt/controller/ScanController.java:
[21,39] package com.cx.business.to.scan does not exist
Above is the error Im getting while trying to do a clean install.The specified package in the above error message package com.cx.util is available as part of the itt.jar. That jar has been added as a dependency to this project. I dont see any errors in eclipse. Only while trying to do install, Im getting the above compilation error.
Analysis Done
Below are the analysis done
Checked for the dependency and the jar is available as part of dependency in pom.xml file.
The application does not show any dependency error in eclipse. Its able to navigate to the corresponding method in the jar file.The issue occurs while executing mvn install command.
Tried executing mvn install via command prompt. Still getting the same error as above.
Have renamed the .m2 repository folder to old repository and re executed the mvn install command. same issue exists.
Need help in getting the above issue resolved.
Any help on this is much appreciated. Thanks in Advance.
Remove from .m2 local repository and execute command mvn clean install
Try to remove and add again dependency in Pom.xml
I am using the Tycho plugin to compile an Eclipse plugin project. When I run the command
mvn clean install my build passes
When I run the command
mvn clean verify install my build fails with the following:
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-p2-plugin:1.1.0:
p2-metadata-default (default-p2-metadata-default) on project
com.mysite.project:
Execution default-p2-metadata-default of goal
org.eclipse.tycho:tycho-p2-plugin:1.1.0:p2-metadata-default failed.
IllegalArgumentException -> [Help 1]
The failure stacktrace is:
at org.eclipse.tycho.p2.impl.publisher.P2GeneratorImpl.getCanonicalArtifact(P2GeneratorImpl.java:193)
at org.eclipse.tycho.p2.impl.publisher.P2GeneratorImpl.generateMetadata(P2GeneratorImpl.java:146)
at org.eclipse.tycho.plugins.p2.P2MetadataMojo.attachP2Metadata(P2MetadataMojo.java:149)
at org.eclipse.tycho.plugins.p2.P2MetadataMojo.execute(P2MetadataMojo.java:108)
at org.eclipse.tycho.plugins.p2.P2MetadataDefaultMojo.execute(P2MetadataDefaultMojo.java:33)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 21 more
From everything I can find on Maven, invoking the install phase should implicitly trigger the verify phase. What's going on here?
personally, i never use mvn install when using tycho, because it will install the bundles into your local repo, and since you're build eclipse bundles, you do not have to push them to your maven repo.
back to your question, calling two phases in a single command is not necessary since the install phase should trigger the verify phase.
so use only mvn verify to build your product or only mvn install to achieve the exact same goal ( and have the built artifact pushed into your local repo )
I developed a maven plugin to install the missing jars that cannot be found in central repository but can be found in local file system,i attach the goal to pre-clean phase and when i execute command "mvn clean compile", the plugin is not executed, instead i got the following error:
i suppose the missing jar in the error is installed firstly and then compile phase is executed. However, the error indicates dependency should be resolved firstly.
PS:
here is the config of my plugin in pom.xml:
I build an Apache Project in java which runs fine on my laptop, now that I try to run the same project in Netbeans on my work PC I get an error:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project aping: Command execution failed.
With a reference to:
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The Maven plugin in Netbeans was installed by default. When I tried to find out if the Apache version in the POM file was correct I tried to check the version on my PC with mvn -version I got the error:
'mvn' is not recognized as an internal or external command,
operable program or batch file.
Does this mean that Maven is not installed on my PC and should I also install Maven on my PC first in order to use the plugin, or should just installing the plugin be enough and do I have a different problem?
The error message you see is
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project aping: Command execution failed.
This is a message from the Maven executable embedded inside Netbeans (so Maven is running), saying that a specific maven plugin (here exec-maven-plugin) failed. This is most likely trying to invoke another program on your computer that is not installed so Netbeans (and hence the embedded Maven) can see it.
If you want to run maven outside Netbeans, you must download and install a copy and invoke the "mvn" binary inside.
You Have to install Maven To run Maven on your PC - http://www.avajava.com/tutorials/lessons/what-is-maven-and-how-do-i-install-it.html see how to install maven
in linux - http://www.mkyong.com/maven/how-to-install-maven-in-ubuntu/
I mistakenly assumed that the problem had something to do with Maven, the problem seems to be something in my source code unrelated to Maven. When I change some of the code the program is build succesfully
I am trying to build my Maven project on Travis. The build process seems to work excepting the built of the RPM package.
I am using the plugin rpm-maven-plugin. The reason seems to be that the RPM binary is not available.
Is there a way to build my RPM package with Travis ?
Here is the location of my project:
https://travis-ci.org/qwazr/QWAZR
Thanks for help.
[ERROR] Failed to execute goal
org.codehaus.mojo:rpm-maven-plugin:2.1.3:rpm (generate-rpm) on project
qwazr: Unable to query for default vendor from RPM: Error while
executing process. Cannot run program "rpm": error=2, No such file or
directory -> [Help 1]
I finally found a full java implementation.
https://github.com/craigwblake/redline
I will test it and edit this response to confirm it works.