maven-2

How to define conditional properties in maven?

眉间皱痕 提交于 2019-12-05 01:15:05
For instance, I would like to have property Configuration set to ${env:AAA} if there is an environment variable AAA and to some other constant value if there is no such environment variable. How do I do it in maven 2? It appears as though you activate a profile conditionally ... <profiles> <profile> <activation> <property> <name>environment</name> <value>test</value> </property> </activation> ... </profile> </profiles> The profile will be activate when the environment variable is defined to the value test as in the following command: mvn ... -Denvironment=test On the off-chance that a system

SCM URL relative to parent SCM URL in POMs

与世无争的帅哥 提交于 2019-12-05 00:41:29
问题 I have a Maven project made of several modules and sub-modules. I use SVN to version the source files. The short story How do I specify URL in scm properties of a POM file, that are relative to the ones of its parent. The long story Some modules and their sub modules share a common version number / release process, and some use independant ones. For the module with independant version number, I have set up a branches/trunk/tags layout, for the release-plugin to be happy. For that, I haveb two

Maven 2 - different dependency versions in test and compile

為{幸葍}努か 提交于 2019-12-05 00:34:12
I have project that depends on commons-httpclient [2.0] (compile). I would like to write some jbehave tests - jbehave-core 3.4.5 (test). Both this dependencies depend on commons-lang but in different versions - 1.0.1 and 2.5. When I execute mvn package I get [BUID FAILURE] in tests section. There is an exception for my testcase in surefire-plugin output: java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.substringBeforeLast(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; As I looked in source code - in commons-lang 1.0.1 - indeed, there is no StringUtils

Setting Maven Java compiler debug to false does not remove line number table?

三世轮回 提交于 2019-12-05 00:13:42
Perhaps this is my lack of understanding, but I would have assumed that doing this in a Maven Java project would disable all debug info from going into the Class file: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <debug>false</debug> </configuration> </plugin> However, I just tested it and while the local variable table is gone, and the source file reference is gone, the line number table is still present. I did a javap -l MyClass and still got things like: protected com.mycorp.myapp.randomMethod(); LineNumberTable: line

maven2: how to share a plugin configuration between parent and children pom?

六眼飞鱼酱① 提交于 2019-12-04 23:41:57
I'm trying to reduce copy/pasting in our maven pom files. We have one master pom and many children projects pom inheriting from the master. I want to share a complex plugin definition looking like: <plugins> ... <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>appassembler-maven-plugin</artifactId> <configuration> <!-- many xml lines here --> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>assemble</goal> <goal>generate-daemons</goal> <goal>create-repository</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.codehaus.mojo

Error abotut dynamic web module version reported by STS

旧时模样 提交于 2019-12-04 23:24:17
问题 I've created a web project in STS 2.9.2 using Spring 3.0.6 and Maven 3.0.3. I've created some pages and code with no errors. I've upgraded Spring libraries version from 3.0.6 to 3.1.2 in project's pom.xml and now I get following error message: Dynamic Web Module 3.0 requires Java 1.6 or newer. Dynamic web module version and Java compiler version in project's faces are set to 2.5 and 1.6 respectively. Also set JRE system library for my project to 1.6. I've tried to remove Maven nature and then

How to use or abuse artifact classifiers in maven?

我的未来我决定 提交于 2019-12-04 23:07:01
We are currently attempting to port a very (very) large project built with ant to maven (while also moving to svn). All possibilities are being explored in remodeling the project structure to best fit the maven paradigm. Now to be more specific, I have come across classifiers and would like to know how I could use them to my advantage, while refraining from "classifier anti-patterns". Thanks from: http://maven.apache.org/pom.html classifier: You may occasionally find a fifth element on the coordinate, and that is the classifier. We will visit the classifier later, but for now it suffices to

How do I get verbose output from Maven in the Eclipse console?

我们两清 提交于 2019-12-04 22:46:13
I am trying to figure out why a maven project is not packaging a jar. This is a builds successfully on my coworkers computers. There are no errors when I build, but the jar is not in the destination folder. I was hoping that by getting more verbose output from the maven process, that I could determine the differences between what is happening on my installation, and on other peoples installations. Choose "Run As" -> "Maven build.." or open your Run/Debug configuration There you can enable Debug output or append a -X behind your goals. 来源: https://stackoverflow.com/questions/16898801/how-do-i

How to override log4j.properties during testing?

送分小仙女□ 提交于 2019-12-04 22:45:20
I'm trying to log all DEBUG messages to console during testing in maven. For this purpose I created a file src/test/resources/log4j.properties , which is going to override the configuration I already have in src/main/resources/log4j.properties . Unfortunately such an overriding is not happening. Why and how to fix it? Rename your test configuration file to e.g. log4j-surefire.properties and configure log4j to pick it up during surefire execution: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.6</version> <configuration>

How to disable auto “Update Maven Dependencies” after saving a pom.xml?

谁说胖子不能爱 提交于 2019-12-04 22:32:07
问题 How to disable auto "Update Maven Dependencies" after saving a pom.xml in Eclipse IDE with m2eclipse Plugin? 16.04.10 11:09:40 MESZ: Refreshing [/project/pom.xml] 16.04.10 11:09:40 MESZ: Maven Builder: AUTO_BUILD 回答1: You can't. But why would you even want to do that? Keeping your project build path in sync with the pom is a good thing. 回答2: Window -> Preferences -> Maven -> enable Offline option 回答3: You can edit "Goals to run when updating project configuration" in Window > Preferences >