I am trying to run the Broadleaf Demosite project in eclipse. I have setup the Demosite by following the instructions from the
Getting started guide from broadleaf site. The default code in the build.properties file inside the Demosite maven parent project shows this,
#required
maven.home=/usr/share/maven
#optional
jrebel.path=/usr/lib/jrebel/jrebel.jar
As maven.home is required to start up the server and so now that I have downloaded and extracted the maven 3.0.4 in C:\Users\admin\Downloads\apache-maven-3.0.4\lib.
What is the path I have to specify in the maven.home line in the properties file,
Should it be something like this?
maven.home=C:\User\admin\apache-maven-3.0.4\lib
Maven is shipped into a .zip archive. So unzip maven where do you want. Let's say somewhere like :
C:\User\admin\apache-maven-3.0.4\
then set into your build.properties
maven.home=C:/User/admin/apache-maven-3.0.4
and this should work.
I just changed the maven.home to point to the path like this,
maven.home==/Users/admin/Downloads/apache-maven-3.0.4
Download maven and extract it wherever you want in you computer. Set the path to that directory using command prompt,
C:\Users\admin>set PATH="c:\Users\admin\downloads\apache-maven-3.0.4\bin";%PATH%
Now I'm able to start the jetty server in eclipse with BUILD SUCCESS.
UPDATE:
As the above solution only works for once and you need to run that command every-time you restart the system. For it to work always you have to set the PATH environment variable for maven. Look at How to install maven in Windows? for a permanent solution. Once installed run the following to check if you have installed maven correctly and to check other variables are properly set.
CMD PROMPT
C:\Users\admin>mvn -version
Apache Maven 3.0.4 (r1232337; 2012-01-17 14:14:56+0530)
Maven home: c:\Users\admin\Downloads\apache-maven-3.0.4\bin\..
Java version: 1.6.0_32, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_32\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
C:\Users\admin>
If all the above works fine then in the properties file, you have to specify the maven home directory which in my case was,
C:/Users/admin/Downloads/apache-maven-3.0.4
Sometimes the single forward slash(/) doesn't work in Windows, so replace it with double-forward slash(//) and that should work.
Default value in build.properties file:
#required
maven.home=/usr/share/maven
You have to follow the below format:-
#required
maven.home=C://Program Files//apache-maven-3.0.5-bin//apache-maven-3.0.5
Related
I just updated IntelliJ IDEA from 2021.3 to 2022.1, and it appears I lost maven support.
I have a scala plugin, which was automatically installed, but I've never had to do anything to have the option to build a project as a maven project, but now that option is gone. The new menu format offers me native IntelliJ, or Gradle.
If I look for plugins, there are a ton of them, but they all appear to be "extra features", and none of them (that I can see, it's hard to be sure with so many) are actually core JetBrains tools (which I would expect this to be).
Here is the new project window, offering IntelliJ and Gradle build systems, but not maven. The IntelliJ page shows a screenshot of this page that includes maven.
Since I suspect this will be the next question from kind folks trying to help, here's the window I get if I try to "add framework support" to the project:
Again, Maven's not on the list.
Also, FWIW, this is my command line:
$ mvn --version
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /home/simon/apache-maven-3.8.1
Java version: 17.0.1, vendor: Eclipse Adoptium, runtime: /usr/local/jdk-17.0.1+12
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-117-generic", arch: "amd64", family: "unix"
What can I try next?
You can add Maven framework to your module by right clicking the module -> Add Framework Support and selecting Maven.
(Posted solution on behalf of the question author, to move it to the correct place).
The solution, courtesy of the IntelliJ forum, is that for reasons I didn't ask about, the installation had a file "disabled_plugins.txt" which explicitly named Maven. This file was in the config directory, and for me, on Linux, was: ~/.config/JetBrains/IdeaIC2022.1/disabled_plugins.txt.
Deleting that file and restarting allows everything to work as expected.
I was testing the move from a Jenkins docker image to another using Thinbacvkup and restore the backup and restore went well and of course it didn't bring maven with it (No problem there) I went online and got the latest apache maven bin file (apache-maven-3.8.4-bin), extracted and set up the global tool configuration, export M2_HOME ...ETC. BUT for some reason, it didn't work giving me the same message
#tmp/durable-e665ee46/script.sh: 1: mvn: not found
searched and searched nothing worked, so I went to the original docker and got the same maven from there (apache-maven-3.5.3-bin)edited the configs and all, and it worked but now I wanted to know why did this work and that won't is there something with my project, build or what?
Not using a Docker image, but had no problem on a clean install, no plugins,
Global Tool Configuration ( /configureTools/ ), add maven configuration:
Create job with Invoke top-level maven step, choose same maven version:
If a pipeline job, then the reference would be tools:
tools {
maven 'maven-3.8.4'
}
or withMaven:
withMaven(
// Maven installation declared in the Jenkins "Global Tool Configuration"
maven: 'maven-3.8.4',
Works fine. I did not set M2_HOME or add to PATH; Tool configuration takes care of that.
Started by user admin
Running as SYSTEM
Building in workspace C:\Users\jenkins\.jenkins.2.322.new\workspace\M-Foo
Unpacking https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip to C:\Users\jenkins\.jenkins.2.322.new\tools\hudson.tasks.Maven_MavenInstallation\maven-3.8.4 on Jenkins
[M-Foo] $ cmd.exe /C "C:\Users\jenkins\.jenkins.2.322.new\tools\hudson.tasks.Maven_MavenInstallation\maven-3.8.4\bin\mvn.cmd -version && exit %%ERRORLEVEL%%"
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: C:\Users\jenkins\.jenkins.2.322.new\tools\hudson.tasks.Maven_MavenInstallation\maven-3.8.4
Java version: 1.8.0_312, vendor: Temurin, runtime: C:\Tools\Java\jdk8\jre
Default locale: en_CA, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Finished: SUCCESS
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: C:\Users\jenkins.jenkins.2.322.new\tools\hudson.tasks.Maven_MavenInstallation\maven-3.8.4
Note: you must have proxy set up properly for the "Install from Apache" to populate for "Install automatically".
If you un-tick "Install automatically", then you must input the MAVEN_HOME (which should really be labelled M2_HOME) and then choose that.
Started by user admin
Running as SYSTEM
Building in workspace C:\Users\jenkins\.jenkins.2.322.new\workspace\M-Foo
[M-Foo] $ cmd.exe /C "C:\Tools\apache-maven\apache-maven-3.8.1\bin\mvn.cmd -version && exit %%ERRORLEVEL%%"
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\Tools\apache-maven\apache-maven-3.8.1\bin\..
Java version: 1.8.0_312, vendor: Temurin, runtime: C:\Tools\Java\jdk8\jre
Default locale: en_CA, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Finished: SUCCESS
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\Tools\apache-maven\apache-maven-3.8.1\bin..
I am new to Maven and Ubuntu. I am having trouble building maven projects. When I run the mvn clean -X command I can see the below DEBUG logs.
[DEBUG] Reading global settings from /space/user/programs/apache-maven-3.5.3/conf/settings.xml
[DEBUG] Reading user settings from ?/.m2/settings.xml
[DEBUG] Reading global toolchains from /space/user/programs/apache-maven-3.5.3/conf/toolchains.xml
[DEBUG] Reading user toolchains from ?/.m2/toolchains.xml
[DEBUG] Using local repository at /space/user/git/receiver/?/.m2/repository
I have following settings in .bashrc file
export JAVA_HOME=/space/user/programs/jdk1.8.0_162
export M2_HOME=/space/user/programs/apache-maven-3.5.3
export MAVEN_HOME=/space/user/programs/apache-maven-3.5.3
And I have settings.xml file in /home/user/.m2 folder
Why maven is not picking /home/user/.m2/settings.xml? What is it that I am missing here please? If you need any further information please let me know and I will update the question.
I am using Ubuntu 16.04.
UPDATE:
Output of mvn --version command
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T19:49:05Z)
Maven home: /space/user/programs/apache-maven-3.5.3
Java version: 1.8.0_162, vendor: Oracle Corporation
Java home: /space/user/programs/jdk1.8.0_162/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "4.13.0-37-generic", arch: "i386", family: "unix"
UPDATE:
Overriding settings on command line like this mvn --settings /home/user/.m2/settings.xml clean -X works fine. But this is not the solution I want.
The solution was to use 64-bit JDK on a 64-bit system. I somehow copied 32-bit JDK, and this was the problem. It worked as expected with a 64-bit runtime.
This question helped me solve the issue - Java: System.getProperty("user.home") returns "?"
Note: your linux machine might have both a 32-bit and a 64-bit version of the JVM installed. Even Java 11. #Newbee is correct that this can cause weird maven behavior that they described. Check your alternatives to see which one is being pointed at (for CentOS / RHEL machines):
ls -l /etc/alternatives/java_sdk_11
sudo alternatives --display java_sdk_11
sudo alternatives --config java_sdk_11
New to maven. When I run this command i get access denied error? any help? I am trying to configure maven to run with eclipse. Let me know if you need more information.
mvn -Declipse.workspace=<c:\temp\eclipse\workspace>eclipse:add-mvn-repo
Path:
C:\apache-tomcat-7.0.55\bin;C:\apache-ant-1.9.4-bi
n\bin;C:\apache-maven-3.2.2\bin;C:\Program Files (x86)\Google\google_appengine\
C:\Temp\eclipse\workspace>mvn -v
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T09:51:4
2-04:00)
Maven home: C:\apache-maven-3.2.2\bin\..
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_25\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
C:\Temp\eclipse\workspace>cd\Temp\eclipse\workspace
**C:\Temp\eclipse\workspace>mvn -Declipse.workspace=<C:\Temp\eclipse\workspace> eclipse:add-maven-repo
Access is denied.
C:\Temp\eclipse\workspace>**
Configuring Maven to run within Eclipse.
Eclipse has an embedded version of Maven which you can use. Assuming that you want to use Maven within Eclipse and outside of it, download Maven from http://maven.apache.org/download.cgi, extract it and set the M2_HOME environment variable such that it points to your local Maven installation directory.
Set JAVA_HOME environment variable so that it points to the JDK which you want to use.
Append %JAVA_HOME%\bin and %M2_HOME%\bin to the Path so that the jdk and mvn executables can be executed from anywhere.
Now open an Eclipse Workspace and go to Window > Preferences > Maven > Installations. If you want to use your standalone installation instead of using the embedded one, you can change it here.
If you have a specific Maven settings file which you want to use, then dump that settings.xml file under the .m2 folder of your User home directory.
Once this is done, you can easily use Maven from within eclipse.(File > Import > Maven > Existing Maven Projects) or create a new one (File > New > Maven > Maven Project). Once you have a project in your workspace, you can run different Maven goals on it by right clicking on the Project and selecting what you want from the Run As option.
I use maven 3.0.3 and have tried to generate pom for third-party jar like this:
mvn install:install-file -Dfile=cobra.jar -DgroupId=com.cobra
-DartifactId=cobra -Dversion=0.98.4 -Dpackaging=jar -DgeneratePom=true
According to link below it should generate proper pom.xml and install artifact in the repo.
http://maven.apache.org/plugins/maven-install-plugin/examples/generic-pom-generation.html
Meanwhile, it returns such a error:
[ERROR] The goal you specified requires a project to execute but there
is no POM in this directory (D:\cobra-0.98.4\lib). Please verify you
invoked Maven from the correct directory. -> [Help 1]
Why is it asking for pom.xml while it should generate pom.xml?
This is an old question, but was a serious PITA for me for a few minutes, so I thought I'd share:
I just ran into this problem, and I believe that the issue is probably platform-dependent. The real tip-off was that the solution from Cyril's answer wasn't working as expected: despite my specification of -DgroupId=com.xyz and -DartifactId=whatever on the command-line and the corresponding entry in the POM file, the jar was installed in the local repo under com/whatever.
This led me to experiment with quoting command-line arguments, and the eventual correct result from formatting the command-line like this (after deleting the POM file):
mvn install:install-file "-Dfile=cobra.jar" "-DgroupId=com.cobra" "-DartifactId=cobra" "-Dversion=0.98.4" "-Dpackaging=jar" "-DgeneratePom=true"
Some of the quoting is doubtless redundant, but better safe than sorry, right? I happen to be running Vista on this computer, and would not be surprised if this problem were specific to this OS version...by the way, this was with Maven v3.0.4.
Are you sure that you are executing the install-file goal? I checked your command and it works for me, but when I place a blank install :install-file (maybe you have this typo) the install goal would be used which needs a pom.xml.
Try to use the -X parameter to get more debug information:
-X,--debug Produce execution debug output
My system
Maven
c:\>mvn -version
Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
Maven home: C:\progs\apache-maven-3.0.3
Java version: 1.6.0_21, vendor: Sun Microsystems Inc.
Java home: c:\Program Files (x86)\Java\jdk1.6.0_21\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
Install Plugin
c:\>mvn -Dplugin=install help:describe
Name: Maven Install Plugin
Description: Copies the project artifacts to the user's local repository.
Group Id: org.apache.maven.plugins
Artifact Id: maven-install-plugin
Version: 2.3.1
Goal Prefix: install
This plugin has 3 goals:
install:help
Description: Display help information on maven-install-plugin.
Call
mvn install:help -Ddetail=true -Dgoal=<goal-name>
to display parameter details.
install:install
Description: Installs the project's main artifact in the local repository.
install:install-file
Description: Installs a file in the local repository.
For more information, run 'mvn help:describe [...] -Ddetail'
I found a bypass. You need to create a simple pom.xml like this :
<project 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.cobra</groupId>
<artifactId>cobra</artifactId>
<version>0.98.4</version>
</project>
It's not perfect but it's worked for me. If you find a better way to do that, I'm interested.
My config :
$mvn -version
Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
Maven home: /usr/local/maven
Java version: 1.6.0_20, vendor: Sun Microsystems Inc.
Java home: /usr/local/jdk1.6.0_20/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-25-generic-pae", arch: "i386", family: "unix"
$mvn -Dplugin=install help:describe
...
Name: Maven Install Plugin
Description: Copies the project artifacts to the user's local repository.
Group Id: org.apache.maven.plugins
Artifact Id: maven-install-plugin
Version: 2.3.1
Goal Prefix: install
...
Try to run it on cmd.exe or execute cmd command before the mvn command.
Using maven version 3.6.3, this worked for me to generate pom file in my chosen directory:
C:<MyChosenDir> mvn archetype:generate "-DgroupId=com.mycompany.app" "-DartifactId=my-app" "-DarchetypeArtifactId=maven-archetype-quickstart" "-DarchetypeVersion=1.4" "-DinteractiveMode=false"
just go under your project directory where you can find your pom.xml file then execute the same command ! it works for me ;)
If you are having trouble with the command line version of Maven, you might want to try the M2E plugin for eclipse. It is far more user friendly for people without very much experience with Maven.
It worked for me when I changed Powershell to Cygwin. Powershell is somehow parsing the command line argument incorrectly.
I had that error when I was using maven in Windows, what worked for me was opening the cmd and not the PowerShell.
Apparently certain errors appear when you don't do it with the cmd.
I hope it works.
If you are getting this error during jenkins pipeline setup , Then the error is we are placing git repository without .git in jenkins git url blank .Generally we put website url of git repo but we need to place clone url of git repo.Insert .git (cloned url) to website url , Simply insert git clone url.