maven-2

Maven: Only execute plugin when a command line flag is present

瘦欲@ 提交于 2019-12-01 21:20:18
问题 I want Maven to only run a certain plugin when there is a flag on the command line when I call the mvn command. for example: Let's say I have a plugin called maven-foo-plugin . I only want maven to run this plugin when the flag --foo is present when I call the maven command. So, instead of saying... mvn install ...I would say... mvn install --foo The first one should NOT use/call the plugin maven-foo-plugin , but the second one should. By default, I don't want this plugin to run, but if and

Scala, Maven, and preprocessors

Deadly 提交于 2019-12-01 20:52:06
问题 I know all of the philosophical arguments against preprocessors and macros in Java. I don't agree that just because some may abuse a language feature, it should be excluded for all. I would like to include __FILE__ and __LINE__ macros in my Java and Scala code for efficient logging. Any use of Exception is unacceptable because of runtime performance impacts. Those people who argue that logging can be turned off in "production code" should heed the advise of Brian Kernighan: Removing the error

Maven + Mercurial for Build Numbers

白昼怎懂夜的黑 提交于 2019-12-01 20:36:14
问题 I can't figure out how to get a Mercurial revision id put into my Maven build (ideally I would like it in the MANIFEST of my jars and war). The closest solution I could find is: mvn -DbuildNumber=`hg id -i` Which won't really work for Windows or my Hudson server. Luckily Hudson tags my builds but I would like some more assurance if the builds were also tagged with the Mercurial changset id. 回答1: Have a look at this previous question and the link from the accepted answer. Basically, you want

Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/http/ConnectionReuseStrategy:

百般思念 提交于 2019-12-01 20:20:46
问题 I am trying to run as Java Application in a maven project with Eclipse and I am getting the following run time error.The error is shown below. Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/ConnectionReuseStrategy at com.wang.testMaven.App.main(App.java:16) Caused by: java.lang.ClassNotFoundException: org.apache.http.ConnectionReuseStrategy at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java

Maven + Mercurial for Build Numbers

≯℡__Kan透↙ 提交于 2019-12-01 19:47:26
I can't figure out how to get a Mercurial revision id put into my Maven build (ideally I would like it in the MANIFEST of my jars and war). The closest solution I could find is: mvn -DbuildNumber=`hg id -i` Which won't really work for Windows or my Hudson server. Luckily Hudson tags my builds but I would like some more assurance if the builds were also tagged with the Mercurial changset id. Pascal Thivent Have a look at this previous question and the link from the accepted answer. Basically, you want to do the same thing except that you'll want to use the buildnumber:hgchangeset goal with

compiling project with jdk1.5 using maven2

≯℡__Kan透↙ 提交于 2019-12-01 19:20:17
问题 i managed to create my project structure using maven2. but when am compiling my project using mvn install getting error generics are not supported in -source 1.3 googled to build my project using jdk1.5 and added build tag <project> <modelVersion>4.0.0</modelVersion> <groupId>com.myProject</groupId> <artifactId>project</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>myapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit<

Maven release plugin fails when creating tag

柔情痞子 提交于 2019-12-01 19:10:39
I'm trying to use Maven release plugin 2.0 to tag the version and hopefully deploy the resulting jar to the repository. I got stuck at release:prepare , getting this cryptic error: [INFO] Checking in modified POMs... [INFO] Executing: cmd.exe /X /C "svn --non-interactive commit --file C:\Users\ME~1\AppData\Local\Temp\maven-scm-950614965.commit --targets C:\Users\ME~1\AppData\Local\Temp\maven-scm-35306-targets" [INFO] Working directory: c:\workspace\release-test-trunk [INFO] Tagging release with the label release-test-1.3.0... [INFO] Executing: cmd.exe /X /C "svn --non-interactive copy --file C

compiling project with jdk1.5 using maven2

旧街凉风 提交于 2019-12-01 19:01:42
i managed to create my project structure using maven2. but when am compiling my project using mvn install getting error generics are not supported in -source 1.3 googled to build my project using jdk1.5 and added build tag <project> <modelVersion>4.0.0</modelVersion> <groupId>com.myProject</groupId> <artifactId>project</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>myapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <

Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/http/ConnectionReuseStrategy:

我只是一个虾纸丫 提交于 2019-12-01 18:57:45
I am trying to run as Java Application in a maven project with Eclipse and I am getting the following run time error.The error is shown below. Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/ConnectionReuseStrategy at com.wang.testMaven.App.main(App.java:16) Caused by: java.lang.ClassNotFoundException: org.apache.http.ConnectionReuseStrategy at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) and my code is shown below public class App { public

Maven: avoid deploying project package-implied artifact during standard build lifecycle

狂风中的少年 提交于 2019-12-01 18:56:01
问题 Is it possible to avoid deploying the artifact that is built according to the project packaging during 'deploy:deploy' processing? I mean the following: suppose we have a 'pom.xml' for web application and define packaging type as 'war' ; we want to assemble either '*.war' artifact or '*.zip' that contains our application as well as a servlet container; we want to deploy only that '*.zip' artifact during 'deploy:deploy' processing; I.e. I want to be able to run 'mvn deploy' and has the