I have some multi-module project.
Some modules are packaged as wars and some as jars.
When I start from the root module : mvn war:exploded I thought it would apply the step only to the war projects. But it tries to apply the mvn war:exploded on all the projects which obviously fails (no web.xml and so on).
Any ideas how can I tell maven to apply in only to the war packaging modules?
When running war:war (which is the goal bound to package for a project with a war packaging), the war plugin automatically creates a directory of the exploded war file first and then compresses it into the actual war file. So why don't you simply run mvn package during your reactor build?
If really this is not an option, you could maybe use one of maven's advanced reactor options, and more precisely:
-pl, --projects
Build specified reactor projects instead of all projects
and list only the war modules.
Related
until now I deployed to a Glassfish server with the default IntelliJ artifact "Web Application: Archive". Now my built process got a bit more complicated with maven modifying several files.
In the glassfish configuration under Deployment, I substituted the Artifact to deploy with the direct war file and put the maven goal in "Before Launch: Another Configuration"
However, if mvn clean was run the war does not exist and I cannot run the configuration (because the external file doesn't exist).
Can I avoid having to run mvn package once manually? E.g. by making the output of a maven goal an Artifact?
Thanks!
Is it possible to convert project .classpath file to pom.xml after converting a simple web application project to maven project? Because if my project uses many jars and I want to convert it to maven then I will do configure->convert to maven but then it is not possible to add all the jars dependencies in pom.xml manually. So is there any tool to convert this.
First there is no tool to do such things. The problem is usually that you have a larger number of dependencies which you don't need to put into the pom.xml file, cause Maven handles transitive dependencies which means you only need to add only direct dependencies. The best thing is to look at the current projects jar files and try to find them in Maven Central and cut&paste the information form the search output into your pom. And of course test the build via Maven on command line.
I have pom.xml file that contains dependencies and files to checkout from svn so there is no no need to generate project. I just need these libraries and those files, so is there any way to get them without generating a project with maven directory structure?
I'm not sure from your question what do you want. If you have pom.xml file and you want to download all dependencies defined in it, you can call
mvn dependency:copy-dependencies
For more options look maven copy-dependencies task page
If you are asking how to create pom that will contain no code, but only dependencies, you can do that by specifying pom packaging.
on my Windows machine I do have several proeject that I build with maven. At the moment they are all in SNAPSHOT-State. When I build a project that relies on one of the other projects maven always adds the class files of the other projects to the jar.
If I build the project on my CI-Server this problem does not occur. Does anyone have an idea why maven adds the class files to my jar?
I'm using maven 2.2.1
When I build a project that relies on one of the other projects maven always adds the class files of the other projects to the jar.
This is not a default behavior and, if it happens, you're somehow telling Maven to do so. If you want to hunt potential discrepancies, check the effective-pom, the effective-settings, the active-profiles using the following goals on both machines:
help:effective-pom
help:effective-settings
help:active-profiles
Also double check how Maven is invoked on the CI machine (extra command line parameter, etc).
I have customized pom.xml in maven to build a war file, for which i am compiling few class files which in deed depends on some jar files. Which i have included them as dependencies.
The build was successful but end result puts me in trouble now i have those class files included in my war which i don't want it.
So can you please help me to get rid of jar getting included in lib folder of war.
Regards
Gnash-85
You just have to change the "scope" of your dependencies in the Maven pom from "compile" (by default) to "provided". The "provided" libs won't be included in the final war file.
All options are listed on the Maven documentation.