from command line I can write
mvn install -Pauto-deploy
Is it possible to store this command in my eclipse maven plugin. I want to execute this command by click.
I see only standart things in maven menu:
build
clean
install
test
I want see at this list my_autodeploy_command
I am sure it is possible but I don't know how.
Can you show how?
where can I write mvn install -Pauto-deploy ?
Somewhere here?
UPDDATE
for taringamberini
The dialog is the correct one. Install, the lifecycle phase to run up to, is put into the goals field, your profile (auto-deploy) is put into the Profiles field (without -P):
You could also copy the full line (without leading "mvn") into the Goals field
Is it possible to store this command in my eclipse maven plugin.
Yes, it is:
In the Package Explorer view right click your Maven project
choose Run as and Run configurations...
right click on Maven Build (node added by your eclipse maven plugin) and choose New
Compile the filed Name for example with clean_test_install
Compile the field Base directory browsing your maven project directory
Compile the field Goals for example with clean build test install
click Apply and close the Run Configuration window
Now, in the tool bar, if you click on the drop down menu at the right of the Run As ... button you can see the clean_test_install entry.
UPDATE
You can do it in maven plugin in eclipse as below.
Go to debug configuration eclipse --> New configuration in Maven Build
Specify Goals as clean -install and select base directory as project which you want to build. You can also skip test if we want in configuration
I had an ugly/complicated maven command which launched my project. And On Windows, I wanted to launch it in eclipse - to see the console, and not under a command prompt - where you can't see the console clear. The Maven command was something like:
mvn -am -pl web package -DskipTests -P link-repo,tomcat-run,local-jive -Dfile.encoding=UTF8
So blackbuild answer:
"You could also copy the full line (without leading "mvn") into the Goals field"
saved my life!
I just copied the maven command in Goals field and it worked!
Related
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
I am trying to use Maven in Eclipse, and I am trying to package my project. I right click on My pom.xml, I go to Run as, but there is no "Maven Package" option there.
This is how it looks:
What am I doing wrong, and how can I get that option?
If you do the Maven install it should also do the packaging. You will find the resulting artifacts in the directory called target.
If you want to run only mvn package, I believe you need to select the option number "3 Maven build ..."
I would like to create a 'site' containing test reports for my Maven Java project. However, all the online resources that I found were talking about the command 'mvn site'. I do work on Windows, though, therefore I would like to avoid any interaction with its console.
Can I do it using solely the Eclipse Maven Plugin? If I want to tell Maven to build my project, I can right-click it and then choose 'Run As' 'Maven Install'. Is there something similar for generating sites?
Thank you all in advance!
Why the hate for specifically the Windows command prompt? What has it done to you to deserve a cold shoulder?
In any case and more seriously: Eclipse allows you to define run configurations yourself. run -> run configurations. Under "maven build" you can add a new configuration to do a mvn site. This page gives an idea by demonstrating how to do a clean install:
http://books.sonatype.com/m2eclipse-book/reference/running-sect-running-maven-builds.html
What is the command that m2eclipse runs when you
highlight a project -> Menu Project -> Clean -> Select anything -> Ok ?
It then goes on to "Building Workspace".
What is the command that allows it to do so?
The reason I am asking is that I am trying to do this from outside Eclipse, from the command line. I am trying to automate all maven stuff in a Groovy script. I am on Windows xp.
EDIT:
Also, the command update maven dependencies would be nice to have as well.
Thanks!
Maven-invocations are put in the Run and Debug menus. Just building the workspace does not run maven - it just does all the work Eclipse needs to do to know your files.
For your purposes these will suffice for the command line build:
cd /to/where/pom.xml/is
mvn clean
mvn install
No commands are directly run. Instead, the m2e plugin uses the configuration in the pom to create equivalent configurations in eclipse.
For example, if you change the source directories it will update the eclipse source directories for the java builder. If you change the target directories for the source compilation, it'll ensure that when you do a Project -> Clean, the plugin knows which directories to clean.
If you are trying to do this though a scripting language, I would recommend just running commands on the command line. The alternative would be to add the maven libraries to the classpath and to use them.