I created a dynamic web project in eclipse for a web service with axis2. I then converted it into Maven project, I'm able to compile and generate war file in eclipse, but when i deploy it on server and try to build it with Hudson-3.0.0 it gives me following error:
mojoFailed org.apache.maven.plugins:maven-compiler-plugin:2.3.2(default-compile)
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project WebServices: Compilation failure
Unable to locate the Javac Compiler in:
C:\Program Files (x86)\Java\jre6..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
Please Let me know what's wrong with it!
I have exactly the same problem, ever since I upgraded Hudson from 2.2.1 to 3.0.1.
Both JAVA_HOME environment variable and JDK in hudson configuration point to JDK and not to JRE.
If I run mvn compile in the workspace directory of the job, everything works well.
Looks like the hudson cannot find java_home.
In hudson settings java.home property is set correctly ?
Does any other java projects builds successfully ?
Did you do what the exception said yet?
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
Sounds like you don't have Java installed. So install it.
Related
I am having issues building orekit. I am following this guide below:
https://www.orekit.org/site-orekit-latest/building.html
I have installed jdk and installed java (version 14.0.2) to the path as well as incorporated the necessary users paths (JAVA_HOME, M2_HOME, and MAVEN_HOME). I also installed the latest version of maven version 3.6.3). I tried running "mvn package" and it came up with a build failure:
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users####). Please verify you invoked Maven from the correct directory. -> [Help 1]
I am not very technically proficient using the command prompt. I assume I need something relating to orekit in the same directory. I have a folder labeled orekit which I got from github in the same directory but I still get the error.
Help please.
We have a Bamboo build that includes a multi-module Maven build task, for a mixed scala/java project.
The build has worked fine for many months, but started failing today.
Maven successfully builds several modules, then consistently fails on a particular module, with the error:
[ERROR] No compiler is provided in this environment.
Perhaps you are running on a JRE rather than a JDK?
However, a JDK is installed, and this module compiles and builds fine if I log into the bamboo server and run maven manually just for this module.
JAVA_HOME appears to be set correctly on the bamboo server and points to a valid JDK, and I can run javac -version without issue.
No updates have been made to this server recently.
How can we fix this build?
I've found the problem (though not the root cause).
The Maven module that fails is the first one that includes java source files (rather than pure scala), so it is the first module for which Maven tries to invoke javac.
The Maven task in Bamboo specifies a particular named JDK profile.
Checking the Bamboo settings for this JDK, I found that it is set to a path that actually points to a JRE (as indicated by the original error message).
(A JRE is no good because it doesn't include the javac compiler and other build tools).
It is not clear how this path got changed/corrupted (nobody else had access to the server, so it suggests an issue within Bamboo itself) but editing this path to point to the installed JDK again fixes the build.
every pioneers,
I want to try to build Spring Roo 2.0.0.M2(http://projects.spring.io/spring-roo/) with its saying of STS 3.7.0 and JDK 1.7.0_45, and I couldn't find the solution even according the post on other sites or on " Builds failing after upgrading to Java7, Missing Tools.jar and bad class versions " .
The error messages on auto generated POM.xml are:
??????????????????????????????????????
You need to run build with JDK or have tools.jar on the classpath.If this occures during eclipse build make sure you
run eclipse under JDK as well (com.mysema.maven:apt-maven-plugin:1.1.3:process:default:generate-sources)
org.apache.maven.plugin.MojoExecutionException: You need to run build with JDK or have tools.jar on the
classpath.If this occures during eclipse build make sure you run eclipse under JDK as well at
com.mysema.maven.apt.AbstractProcessorMojo.execute(AbstractProcessorMojo.java:362) at
....
?????????????????????????????????????
Even I have tried: add JDK1.7.0_45 path but not JRE path in STS project, and even I added tools.jar directly in project build-paths, and even I use "mvn generate source" and add the generate jar into source path. The error about apt-maven-plugin:1.1.3 is still there.
Is there any person who can help? I will try to use old apt-maven-plugin latter.
Background:
I am developing Maven multi module project.
One of the module is common module needed by other all modules.
This module contain CommonClassA.java.
common module is properly compiled.
It is installed into maven local repository properly.
One of the class(Billtype.java) in other module (EmployeeBilling) refers this class(CommonClassA.java).
Maven Dependency for common module is properly specified in pom.xml of EmployeeBilling module.
Problem:
While compiling EmployeeBilling module it throws
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project EmployeeBilling: Compilation failure
[ERROR] \MyWorkspace\Biz\EmployeeBilling\src\main\java\com\employee\Billtype.java:[79,19] error: cannot access CommonClassA
[ERROR] -> [Help 1]**
Supporting details:
dependency defined in EmployeeBilling> pom.xml:
Other classes from common module seems accessible as no error observed
There are no other errors like Class not found/file not found.
The class CommonCLassA implements Serializable
Same error occurs from Eclipse as well as commond line
I am using M2E plugin
Tools:
jdk1.7.0_02
OS: Windows 7
Eclipse JUNO and apache-maven-3.1.0
Thanks in advance!
If project builds properly using eclipse compiler then it should work with Maven.
Few things to check if its not working with maven:
Manually check in repository that jar is installed properly and it contains your class file.
Try to build project using locally installed Maven instead of maven in eclipse.
Set -DskipTest=true while installing your jar, as it can cause issues at times.
If these steps don't work then show us your pom.
With no more information it's hard to find the cause. But I also had this problems now and then, and there are some things which could go wrong:
Are you using the right JAVA version (everywhere) ?
... and the right java PROVIDER? (Oracle, IBM, OpenJDK) In my case it's often this issue, I'm sometimes bound to IBM JDK, although I try to use Oracle where I can and this sometimes breaks my build.
Is the right maven dependency VERSION used? If you depend on it multiple times, and all in the same (lower than root) dept of dependencies, Maven will just "choose" a version. It could be that thát version is incompatible with your code of thát particular dependency
Skipping tests sometimes WORKS! It has something to do with maven phases and getting stuff ready for using it elsewhere.
Good luck :)
I had the same problem. Even the jar dependency has the required class files. Finally I deleted the local maven repo and restarted the build. Now it worked without any issue.
It looks like you are using an old version of maven-compiler-plugin (v2.3.2).
I suggest you upgrade it to 3.x. it won't magically fix your issue but it will definitely give you better / more detailed error message.
Can someone let me know how to fix the same?.I tried to create a new maven project and it fails for some reason
Description Resource Path Location Type
Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.5:resources failed: A required class was missing while executing org.apache.maven.plugins:maven-resources-plugin:2.5:resources: Lorg/sonatype/plexus/build/incremental/BuildContext;
Have updated the maven-resource-plugin to version 2.6. It works fine with M2Eclipse integration v1.3 milestone.
My experience with eclipse and maven is not good I have been working for a long time with both and they don't integrate properly. The best way to make them work together for me was to use command line to build, package and install the projects and eclipse to edit.
To import the projects into eclipse I just use mvn eclipse:eclipse and it will generate the files needed to import the project into eclipse.