I'm trying to build a war file to be deployed to a tomcat server using Maven, but have noticed some strange behaviour when building my war file:
When running the command from project folder: mvn clean compile package -DskipTests
Maven version 3.0 produces a war file
12.079MB (49 jar files in WEB-INF/lib folder)
Maven version 3.0 beta1
produces a war file 8.7MB (31 jar
files in WEB-INF/lib folder)
Maven version 2.11 produces a war file 2.3MB (3 jar files in WEB-INF/lib folder)
What can be causing the extra jar files to be included in the project? Presumably they are not needed as building the project using version 2.11 has worked fine in the past.
I had something similar happen to me. Here's what happened.
In Maven 2.x the plugin versions are set by Maven itself. In Maven 3.x it will use the "latest" and give you a warning. In my case, using a later version of the compiler plugin caused some differences and a later version of the dependency plugin cause other differences.
Once I explicitly set all the versions of all plugins in my pom.xml (a best practice anyway), the inconsistencies went away.
Related
I have a multi-module project that uses maven. Is there a way I can point IntelliJ to maven target/ folder so when I start Debug it won't rebuild the project from scratch and re-upload a whole project via JRebel all over again.
Basically, use target/ as a build folder. Changing compile output path didn't work as I expected it to not compile classes that were compiled by mvn already.
The IntelliJ Run/Debug configurations can specify which actions happen before launching the application.
By default for say web applications, this would display
Build
Build x artifact
You may remove both entries if you are happy with building via maven before launching the application.
Regarding the JRebel side of it - it should certainly not be updating the classes on the second compile assuming nothing changed. The classes have their hashes checked before a reload. This is assuming maven and IntelliJ are using the default javac compiler. If either is configured to use ecj compiler, it's best to let JRebel only see classes built with the same compiler.
I am trying to use a GraphDB repository from a Maven project using Eclipse Neon with builtin Maven. Where can I find the GraphDB runtime jar file to place in local Maven repository? Why GraphDB is not available from Maven Central?
update I have created a GraphDB repository and it works fine. Now I would like to setup a Maven project in Eclipse Neon to interact with the repository programmatically. GraphDB is not available from Maven central. Developer Hub instructs users to run "MVN Install" to install GraphDB runtime jar into local Maven repository. Since I am using Eclipse Neon with integrated Maven, there is no (I cannot find) MVN executable to run "MVN Install". So my question is what file(s) should I transfer manually to my local Maven repository?
The jar files that you need are the ones that are located in the installed folder of GrpahDB "app/lib". You just add them to the Build Path in eclipse and copy the Java class EmbebbedGraphDB that is in the examples folder.
I'm using tycho for creating a RCP product but as soon as I set the plugin pom
packaging to eclipse-plugin ,maven dependency library removes from project and cause lots of error because of missing library.I've tried running maven both on terminal and eclipse and they have the same result.Does anyone know how to fix this problem and is there someone that exported a complete RCP plugin using tycho?
thank you.
Tycho does not use maven dependencies to compile your plugin. Dependencies are specified using the plugin Manifest file as with a normal eclipse plugin.
In Eclipse, dependencies will be found using the workspace (assuming m2e & tycho configurators are installed) or from the plugins defined in your target platform (typically the eclipse installation). On the command line, these dependencies should be available in a p2 repository - these can be defined in a target definition file or in a normal maven repository block in the pom file with the p2 layout. See [1] for details on using these.
It is possible to configure Tycho to consider pom dependencies but this will not work when exporting an RCP application - dependencies need to be found in a p2 repository.
[1] http://wiki.eclipse.org/Tycho/Reference_Card#Repository_providing_the_context_of_the_build
I want to use ivy 2.2.0 jar instead of installing ivy on my machine because when anyone import my project from svn its giving errors for jars which I have added to Ivy library.
I added ivy.xml to build path through option add ivy library. how I can configure it through build.xml instead of add ivy library option..
You want to use Ivy without the ivy.jar file? This is not possible.
However, you can make it easier for your users. Ant can automatically download Ivy for you the first time it is used. For the following times, just add Ivy itself as a dependency of your project, so you can easily roll out updates of Ivy, for example.
For the bootstrapping (getting Ivy with plain Ant) see this answer to another SO question.
Some of our new projects have been migrated to maven3 and some of the older projects are still using the maven2 compliant pom.xml files.
Can maven3 runtime execute maven2 compatible pom.xml files also?
maven 3 is mostly compatible with maven 2 configuration. But there is still some incompatibilities.
For a full list you should check here there is also sometime problems with plugins (as Torsten suggested).
Resources:
Maven 3.x Plugin Compatibility Matrix
On the same topic:
switching to maven3
Typically yes, but it may depend on the plugin version you are using.
Please note that e.g. the maven site plugin is different for maven 2 and maven 3 or some options of the maven enforcer plugin are no longer valid for maven 3. There might be others.
Yes, it is.
At first you may be alarmed by the fact that it reports a bunch of warnings and sometimes refuses to build before you take care of the problems, but this is actually better for you as (if you run into this) it simply tells you what was wrong with your project so far.
Other than that, the site plugin is completely re-written and you need to use the version for Maven 3. (Check here)