I recently had to get a new computer at work, and reinstall all programming stuff including Maven. Now I'm trying to release a project change, but I can't get Maven Release to work.
I ran mvn release:prepare from Eclipse, and it completed successfully.
I started mvn release:perform from Eclipse, and it failed with a message saying prepare had failed mid-way.
I ran release:prepare from Eclipse again, and now it failed with "Maven executable not found at: C:\Users\bls\Git\events\EMBEDDED\bin\mvn.bat"
I ran mvn release:prepare from cmd prompt, and it completed successfully.
I ran mvn release:perform from cmd prompt, it gave me some questions and failed with "Unable to tag SCM"
-
There never used to be any folder at C:\Users\bls\Git\events\EMBEDDED\bin
C:\Maven\apache-maven-3.3.3\bin includes both mvn.bat and mvn.cmd.
C:\Maven\apache-maven-3.3.3\bin is added in PATH.
In Eclipse, Window/Prefrences/Maven/Installations I added the proper path and set it to default.
Still not working. Ideas?
You need to rename the mvn.cmd file into mvn.bat folder. In mvn 3.3.x the structure of maven have changed. The mvn.bat file have been changed into mvn.cmd. But in command line this is not taken into consideration. Hope i have help you with your issue.
#Progamactor is correct. You need to
Create the mvn.bat at the location maven complains it needs one.
Add the following contents to that batch (mvn.bat):
#mvn.cmd %*
Related
In our project, there were so many developers are working. And the code will get published into central maven repo only by our Technical lead who uses mvn clean deploy command.
All the other developers should use mvn clean install command to build it in their local & test it. We are suspecting that, some developers mistakenly using deploy command instead of install command.
Is it possible to find out which user ran "mvn clean deploy" command using the resulted/uploaded jar. Is there any entry which will point the system name or userId from which the jar got uploaded ?
The META-INF/MANIFEST.MF text file usually contains a "Built-By" line with the name (OS login) of the user that ran the Maven command.
You can find it by opening the jar as a zip file.
I use a locally built eclips.jdt in my project. I use the command mvn -P build-individual-bundles package to build the package locally and installed the created jar file using mvn install:install-file -Dfile=/location/org.eclipse.jdt.core-3.24.0-SNAPSHOT.jar -DgroupId=org.eclipse.jdt -DartifactId=org.eclipse.jdt.core -Dversion=3.24.0-SNAPSHOT -Dpackaging=jar -DgeneratePom=true
Currently, I have a java.lang.ArrayIndexOutOfBoundsException that's firing from the locally built eclips.jdt. The stack trace given in the IDE doesn't go to the correct code line in eclips.jdt or some code links are not clickable either. But I observed that this does not happen for the jars that I downloaded from the maven central repository. This happens only for the locally built jars.
I further noticed that when I add a debug point to the JavaASTUtil.java:89, the debugger does not step into the code lines that are in the locally built jars either.
Does anybody have an idea about this behavior?
I'm working with multiple projects in Eclipse. because I want to automate the building I want to script the building process.
Unfortunately I cannot do the same actions on the commandline as in Eclipse.
So a common problem is that when a new function from a referenced project is used, I cannot build the project on the commandline with mvn. I use the command:
mvn clean install -U
But this command will give a build failure until I do a Eclipse Maven Update from the eclipse GUI. After that I can build the project again.
I also tried all the other commands I came across Stackoverflow:
mvn eclipse:eclipse
mvn dependency:resolve
So I just want to that Maven Update command in eclipse from the commandline so I can build from the commandline. If anyone could tell me what I'm doing wrong that would be awesome.
Thx in advance
Update for more clarification:
The project structure is:
Rest-service, Framework-service, Framework-model
Framework-model is referenced in the pom file by Framework-service and Framework-service is referenced by Rest-service. The other projects are not relevant to the problem.
When a function is added to Framework-model and used in Rest-service it gives an compilation error in eclipse and when I build with mvn clean install -U, although Maven install in eclipse is succesful but I think it is still using the old compiled code. After a Maven Update command in eclipse the compilation error is gone. And mvn clean install -U from the commandline also works.
How could I do a Maven Update command in the commandline? If mvn clean install -U should also do a Maven Update command, what settings should I check?
Another update: So this weekend I tried different things and running mvn compile before the mvn clean install -U command gives a different output. And finds the new function. But as I read maven, I thought install should also do the previous steps. How is this possible?
Eclipse's Maven plugin uses the maven version configured in Preferences/Maven/User settings. If you have a different version of maven in your Eclipse's settings than the one on your PATH variable, you could have different outputs. Maybe try and check that.
I was assigned to maintain issues in a system created before time.
The system uses Jenkins as system integration tool and unfortunately I do not have previous experience with it.
The problem is following:
When following the steps for local build (via console) the archive files (.jars, .ear) are created correctly.
When using Jenkins job for this, one of the .jar files (call it module-one.jar) included in .ear does not contain a folder with .xsb and .class fiels.
So .ear application becomes incorrect and ClassNotFoundException is thrown.
Steps for building application locally:
cd my_project_path
cd ModuleOne
mvn xmlbeans:xmlbeans
mvn install
cd ..
mvn clean install
The Maven section in Jenkins contains only this goal clean install (the screenshot below section "Build"):
So what I wonder is how to add the following maven tasks in Jenkins job to be executed on ModuleOne:
mvn xmlbeans:xmlbeans
mvn install
My idea is to go to "Pre Steps" section and add following maven goal:
mvn xmlbeans:xmlbeans install
My questions are:
1. If I am on the right way how to define the goal "mvn xmlbeans:xmlbeans install" to be executed exactly on ModuleOne?
2. If I am not on the right way are there at all any solutions to do this with Jenkins?
Here is screenshot with my suggestion for "Pre Steps". In the current configuration (that skips to add proper dirctory with .xsb and .class fiels to ModuleOne) this section is missing, but the section "Build" is as it is used now.
I think your approach is good! But on "pre steps":
Remove "mvn" from Goals
Use Advanced configuration in order to specify the path of your pom.xml
Maven version 3.3.3 (Maven is configured in my system. I'm able to get version number by mvn -version.)
Following is my Maven project in Jenkins:
Which basically asks me to configure Maven.
Below are the only fields available when I select Configure System. Though I gave the path of Maven, the error is not removed and unable to build.
Can someone help on this.
Please check "Jenkins => Configuration => Global Tool Configuration". There you can define your maven-installation not only the the environment-variable MAVEN_HOME.
Afterwards you should be able to select your maven-installation in your project-build.
ln -s /opt/apache-maven-3.5.4/bin/mvn /usr/bin/mvn
run echo $PATH in pipeline script and see paths available to Jenkins user. Once linking with maven bin path, maven started working. To check, run mvn -v in the pipeline.
First you should configure a JDK and NOT an JRE. Furthermore the rootPOM location is relative to the Jenkins Job Workspace which means usually only pom.xml nothing more...