When I type any Maven command like mvn -version, mvn clean install etc. they are not working. But the same maven installation is working properly in eclipse. In the command prompt I get the below option for all maven commands:
It seems that in your Eclipse, you use different maven installation (maybe embedded one).
Firstly the problem is not with maven itself, but probably with wrong usage of java in maven or java is not set properly. If your maven would be properly installed and configured you should see something like this:
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T18:29:23+01:00)
Maven home: c:\apache-maven-3.2.5
Java version: 1.7.0_111, vendor: Oracle Corporation
Java home: C:\appl\JDK7\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
please provide some more information about java -version and your environment paths. Also try to look at your mvn.bat.
Related
and this is my command on cmd:
C:\Users\ADMIN\Downloads\apache-ofbiz-18.12.06>ant run-install
Buildfile: build.xml does not exist!
Build failed
What version of OFBiz are you using? Since 16.12 we no longer use Ant but Gradle. Have a look at the main README file (different suffixes are possible depending on version)
I'm getting this error when I try a Jenkins build on a maven project:
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
The java and maven plugin are installed automatically, after several research, I couldn't find a solution!
Does anyone have ever face this issue?
Go To Jenkins -> Manage Jenkins -> Global Tool Configuration -> JDK. Provide path to the JDK under JAVA_HOME field.
First make sure the your Job in Jenkins doesn't use the "default Jdk" by going to the job:
Press on Configure - > and roll to the JDK section - and make sure you have JDK configure instead of Default.
if you don't have it - go back to Jenkins - > Manage Jenkins -> Configure System - > Jdk and map your Jdk Root for Jenkins.
when you finish that - go back and choose your map JDK - and everything will work.
Go To Jenkins -> Manage Jenkins -> Global Tool Configuration.
Now click on "JDK installations.." under JDK
Uncheck Install automatically
Provide path to the JDK under JAVA_HOME field.
Refer:-
May be this issue is already resolved by now. But I had the same issue recently and I have the following settings in my Jenkins. This happened in my Windows 10 Jenkins installation.
Installed JDK at C:\Java\Jdk8 and made JAVA_HOME point to this location. Also make sure that PATH env variable has %JAVA_HOME%\bin.
Installed JRE (which comes bundled with Oracle JDK installation) at C:\Program Files\Java\JRE.
Jenkins -> Manage Jenkins -> Configure System
Jenkins -> Manage Jenkins -> Global Tool Configuration
# javac -version
javac 1.8.0_201
# java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
# mvn -v
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T14:41:47-04:00)
Maven home: C:\apache-maven-3.6.0\bin\..
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: C:\Java\jdk8\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
I believe the change that fixed the problem was the addition of env variables under Manage Jenkins -> Configure System.
Enter http://localhost:8080/configure. Then go Jenkins Location.
Jenkins Configuration:
Environment variable configuration:
You might not have set JAVA_HOME in Jenkin installed server. Set JAVA_HOME and restart your Jenkin server.
According to your error message you either do not have a JDK installed or you need to configure Jenkins's CLASSPATH to point to your JDK installation.
Just give the JDK path in Jenkins Global Tool configurations, i.e the path where we have kept the jdk file in the di
IF you don't want to add anythig in Global tools Configuration, add new environment variable java.home in the Jenkins slave configuration as maven detects java.home and not JAVA_HOME.
java.home ---> C:\Java\jdk1.8.0_181\jre
I have found a plugin for using StatsD with Jenkins (https://github.com/joemiller/jenkins-statsd-plugin) - however the HPI needs building because it is not available in Jenkins plugin repository nor is it aailable to download.
I followed the official instructions at https://wiki.jenkins.io/display/JENKINS/Plugin+tutorial, but the $ mvn package always exits with [ERROR] java.nio.file.NoSuchFileException: ~/src/jenkins-statsd-plugin/target/classes/META-INF/annotations/hudson.Extension.
I have tried using java 6, 7, 8 and 10 but to no avail.
I wonder if anybody else has come up against this problem building Jenkins plugins and what they're solution was?
I fixed this problem by setting JAVA_HOME to point to Oracle’s version of Java 8. It appears maven uses the JAVA_HOME environment variable, not your $PATH.
Edit: For extra context, Jenv was responsible for the version of Java in my $PATH.
I would like to post here my findings from various sources that worked for me as the accepted answer alone was not sufficient.
I had to downgrade my Java version back to 11 from 13.
I used this quick solution, which doesn't require you having JDK and Maven installed locally.
Moreover, deleting target/classes/META-INF/ directory before executing mvn install again was necessary.
Lastly, passing -Djenkins.version parameter to Maven is required so you need to do something like mvn -Djenkins.version=2.164 install
This will definitely get resolved by using java 1.8.* JDK.
According to:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206842605-Running-IntelliJ-code-coverage-headless-on-Jenkins-
It is possible to use intellij code-coverage runner in a headless environment - i.e. Jenkins.
This is nice since IntelliJ reports much more accurate coverage results on new groovy code than e.g. Cobertura. And I can also collect information from Grails tests - unit and integration. However, I have no idea on how to set it up - gradle, maven, custom build-script or whatever - on Jenkins.
When IntelliJ runs Grails tests it fires the following command:
C:\Program Files\Java\jdk1.7.0_79\bin\java
-XX:+TieredCompilation
-XX:TieredStopAtLevel=1
-XX:CICompilerCount=3
-Dgrails.full.stacktrace=true
-Djline.WindowsTerminal.directConsole=false
-Dgrails.build.listeners=org.jetbrains.groovy.grails.rt.GrailsIdeaTestListener
-Didea.launcher.port=7533
"-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3\bin" -classpath C:\Users\xxx\AppData\Local\Temp\classpath.jar
-Dfile.encoding=UTF-8 com.intellij.rt.execution.application.AppMain org.grails.cli.GrailsCli test-app -echoOut
Which indicates that IntelliJ should be installed to run it headless. Is it possible to execute the above command in a headless env?
I have tried unpacking intellij and by executing the following (slightly modified for linux) command:
java
-XX:+TieredCompilation
-XX:TieredStopAtLevel=1
-XX:CICompilerCount=3
-Dgrails.full.stacktrace=true
-Djline.WindowsTerminal.directConsole=false -Dgrails.build.listeners=org.jetbrains.groovy.grails.rt.GrailsIdeaTestListen r
-Didea.launcher.port=7533
-Didea.launcher.bin.path=/home/jenkins/idea/bin -classpath /tmp/classpath.jar
-Dfile.encoding=UTF-8 org.grails.cli.GrailsCli test-app -echoOut
it fails with:
Error: Could not find or load main class com.intellij.rt.execution.application.AppMain even with idea_rt.jar added to the command with "cp" flag.
Is this a goose chase, or could it be done?
Did you check classpath.jar on Windows? This file is automatically generated and links lots of jars via Manifest to avoid OS limitation for the maximum command line length. Your /tmp/classpath.jar either doesn't exist or doesn't link the dependencies correctly.
Final classpath would include several IDE jars from the lib directory, project classes from the output directory and dependencies, plugin jars, etc. In other words, everything required to run the app would be linked from the generated classpath.jar file.
I have a few questions about Maven and Eclipse which I do not know much about them. I'm new to all these tools. Let me describe what I've done:
1 - installed apache-maven-3.3.9 on my window and placed at "C:\Program Files (x86)\apache-maven-3.3.9".
2 - Added MAVEN_HOME (and M2_HOME) environment variables.
3 - Added the "C:\Program Files (x86)\apache-maven-3.3.9\bin" to the Path environment variable.
4 - Set a proxy for Maven download by creating a xml file under ${user.home".m2]settings.xml. The content of the settings.xml is:
<settings>
<proxies>
<proxy>
<active>true</active>
<protocol>https</protocol>
<host>www.github.com</host>
<port>8080</port>
<nonProxyHosts>www.google.com</nonProxyHosts>
</proxy>
</proxies>
</settings>
5 - Tested and see if the Maven was properly installed:
C:\>mvn --version
C:\
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5 2015-11-10T11:41:47-05:00)
Maven home: C:\Program Files (x86)\apache-maven-3.3.9
Java version: 1.8.0_101, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jdk1.8.0_101\jrr
Default locale: en_US, platform encoding: Cp1252
OS name: "windows server 2008 r2", version: "6.1", arch: "x86", family: "dos"
6 - Tried to generate archetype and got a bunch of errors. Only one error is shown below. Basically, Maven tries to download the plugin but fails. I doubt the errors are caused by internet connection, but I don't know where else I need to look in order to fix this issue. The reason I said I doubted it was the internet connection issue is because I configure my POM file with the external jars on the web and all were downloaded correctly.
C:\>mvn archetype:generate
C:\
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven
-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:mave
n-clean-plugin:2.5: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or on
e of its dependencies could not be resolved: Failed to read artifact descriptor
for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven
-install-plugin/2.4/maven-install-plugin-2.4.pom
Terminate batch job (Y/N)? y
C:\>
So... that is the maven plugins downloading problem.
And here is the Eclipse problem:
1 - Installed Eclipse Neon.
2 - Tried to add the Maven plugins and it say that all maven plugins already installed. I did the Maven plugins before with the previously installed Neon. Then I deleted the Neon Eclipse because it fails to create a simple Maven-archetype project. Then I re-installed the Neon Eclipse. But before I re-installed Eclipse I already deleted all previously-installed Eclipse folders but I do not know where the Eclipse keeps all of Maven info. When the newly-installed Eclipse tries to download the Maven plugins, it recognized that all of the Maven plugins were already installed. I have no ideas where Eclipse keeps all those info about Maven plugins?
3 - Tried again to create an simple Maven-archetype project, then I got this error message:
Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:1.1 from any of the configured repositories.
Could not resolve artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1
Could not transfer artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1 from/to central (https://repo.maven.apache.org/maven2): connect timed out
Could not transfer artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1 from/to central (https://repo.maven.apache.org/maven2): connect timed out
So.. basically, it is the same error message that Maven has.
Questions:
1 - What are the things I need to do get Maven plugins download via command line?
2 - Similarly, what are the things I need to do to get Eclipse to create a simple maven-archetype project?
I did checked out all of questions and answers about the issues of Maven not being able to download the plugins. I did try everything in last several days but no prevail. I understand that the answers/solutions are good but they do not work for me. Maybe I need to other things that I don't know where else I need to look for?
3 - Let say that after all these efforts fail, can I manually download the Maven plugins and configure them via my POM.xml? I checked the apache Maven website and it seems that the answer is "yes" but it does not provide the "how". I know it is NOT the best solution for maven plugins download but if I couldn't fix the download issue, the I will have to resort to the manual download and then configure the POM file.
Would you please show me how to configure the POM.xml file with the Maven Plugins?
Sorry about the long questions, but I'm new to these tools and I'm just trying to get a simple Java project built by Maven via Eclipse.
The proxy in the settings file is for case where the machine you run is behind a proxy (lets say a corporate proxy). You have put github.com as the proxy host which is not right.
If you have the maven installation bundled with eclipse that provides you integration with the IDE itself during the maven lifecycle process. You are however free to add a maven installation of your own by adding a existing maven installation from eclipse as well (you want to use a specific installation of maven with its settings).
If you are behind a corporate proxy , you will have to get the proxy through which the machine connects to the internet. You can then add that detail into the proxy settings in maven. In the case that your corporate proxy uses a dynamic proxy (e.g. a .pac file opposed to static host) you will need to look at options like CNTLM or wagon to work around and get it running.