Re: what does --define do in maven
Hello Stephen and everybody, Thanks for replying (apologies i was not allowed to get back to my PC as I had to go for a BPM installation so couldn't reply in time): I noticed that there was a default in my POM which had a compiler plugin config there as well so when i commented out the compiler plugin my profile with toolchain for jdk 1.5 worked fine for other users to see what i was using : http://codepad.org/RiTy1hAz myweb.war POM but I have this conceptual issue now : If i use SITJDK5 profile that has a hardcoded JDK path for 1.5 it never goes for the default, but if i use the DEVJDK5 profile that has the toolchain it ignores the toolchain and goes for the default if there is one present. So with tool chain I cannot have a default compiler config and will have to have a default profile just for this reason and use -PDEFAULT if i am going for toolchain. Also: if anyone could be kind enough to shed some light on this : If i use DEVJDK5 profile it says: [INFO] Webapp assembled in [105622 msecs] and if i use SITJDK5 profile: [INFO] Webapp assembled in [72607 msecs] with toolchain it takes more time though even though the jdk is the same. Thanks for the help so far. Maven is so easy to work with im lovin it !! (at least for now :D ) Syed... -- View this message in context: http://maven.40175.n5.nabble.com/what-does-define-do-in-maven-tp5485392p5501578.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: what does --define do in maven
Copy your toolchains and Pom into *pastebin* or *gist* and post *the link* I will take a look Do not try posting you Pom in the reply, do not pass go, do not collect $200, do not pick up any community chest cards On Saturday, 18 February 2012, sarmahdi wrote: > Hello Stephen, > > I need some help i guess: > > I tried to use toolchains to actually compile the code with JDK 5 while my > default java_home is jdk6 and it said : > > [DEBUG] Configuring mojo > org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile from plugin > realm > ClassRealm[plugin>org.apache.maven.plugins:maven-compiler-plugin:2.3.2, > parent: sun.misc.Launcher$AppClassLoader@f4a24a] > [DEBUG] Configuring mojo > 'org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile' with basic > configurator --> > [DEBUG] (f) basedir = C:\Alpha\eCorp\eCorp-web > [DEBUG] (f) buildDirectory = C:\Alpha\eCorp\eCorp-web\target > > [DEBUG] (f) compileSourceRoots = [C:\Alpha\eCorp\eCorp-web\src\main\java] > [DEBUG] (f) compilerArguments = > {endorseddirs=C:\Alpha\eCorp\eCorp-web\target/endorsed} > [DEBUG] (f) compilerId = javac > [DEBUG] (f) debug = true > [DEBUG] (f) encoding = UTF-8 > [DEBUG] (f) *executable *= C:\glassfish3withjdk\jdk/bin/javac */(this is > the JDK6)/* > [DEBUG] (f) failOnError = true > [DEBUG] (f) fork = true > [DEBUG] (f) generatedSourcesDirectory = > C:\Alpha\eCorp\eCorp-web\target\generated-sources\annotations > [DEBUG] (f) optimize = false > [DEBUG] (f) outputDirectory = C:\Alpha\eCorp\eCorp-web\target\classes > [DEBUG] (f) outputFileName = eCorp-web-1.0-SNAPSHOT > [DEBUG] (f) projectArtifact = com.riyadbank:eCorp-web:war:1.0-SNAPSHOT > [DEBUG] (f) session = org.apache.maven.execution.MavenSession@46a55e > [DEBUG] (f) showDeprecation = false > [DEBUG] (f) showWarnings = false > [DEBUG] (f) source = 1.5 > [DEBUG] (f) staleMillis = 0 > [DEBUG] (f) target = 1.5 > [DEBUG] (f) verbose = true > [DEBUG] -- end configuration -- > [DEBUG] Using compiler 'javac'. > [INFO] Toolchain in compiler-plugin: JDK[D:/IBM/SDP70/jdk] */(This is the > JDK5)/* > *[WARNING] Toolchains are ignored, 'executable' parameter is set to > C:\glassfish3withjdk\jdk/bin/javac* > > It goes for JDK 6 after getting the toolchain why is it not going for the > JDK that i hard coded for the 1.5 JDk in toolchains.xml > > Do you have any idea: I searched on google and some one said that cos there > is already a JVM installed so it went for that. When i remove the JAVA_HOME > from system environment as a variable then mvn.bat doesnt run cos JAVA_HOME > is not set for it. > > So what do i do now: if i set a JAVA_HOME it falls back on it and ignores > the toolchain, if i dont set the JAVA_HOME then mvn fails > > So what do we do: whats wrong here? > > Thanks in advance. > > Syed... > > -- > View this message in context: http://maven.40175.n5.nabble.com/what-does-define-do-in-maven-tp5485392p5495490.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >
Re: what does --define do in maven
Hello Stephen, I need some help i guess: I tried to use toolchains to actually compile the code with JDK 5 while my default java_home is jdk6 and it said : [DEBUG] Configuring mojo org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-compiler-plugin:2.3.2, parent: sun.misc.Launcher$AppClassLoader@f4a24a] [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile' with basic configurator --> [DEBUG] (f) basedir = C:\Alpha\eCorp\eCorp-web [DEBUG] (f) buildDirectory = C:\Alpha\eCorp\eCorp-web\target [DEBUG] (f) compileSourceRoots = [C:\Alpha\eCorp\eCorp-web\src\main\java] [DEBUG] (f) compilerArguments = {endorseddirs=C:\Alpha\eCorp\eCorp-web\target/endorsed} [DEBUG] (f) compilerId = javac [DEBUG] (f) debug = true [DEBUG] (f) encoding = UTF-8 [DEBUG] (f) *executable *= C:\glassfish3withjdk\jdk/bin/javac */(this is the JDK6)/* [DEBUG] (f) failOnError = true [DEBUG] (f) fork = true [DEBUG] (f) generatedSourcesDirectory = C:\Alpha\eCorp\eCorp-web\target\generated-sources\annotations [DEBUG] (f) optimize = false [DEBUG] (f) outputDirectory = C:\Alpha\eCorp\eCorp-web\target\classes [DEBUG] (f) outputFileName = eCorp-web-1.0-SNAPSHOT [DEBUG] (f) projectArtifact = com.riyadbank:eCorp-web:war:1.0-SNAPSHOT [DEBUG] (f) session = org.apache.maven.execution.MavenSession@46a55e [DEBUG] (f) showDeprecation = false [DEBUG] (f) showWarnings = false [DEBUG] (f) source = 1.5 [DEBUG] (f) staleMillis = 0 [DEBUG] (f) target = 1.5 [DEBUG] (f) verbose = true [DEBUG] -- end configuration -- [DEBUG] Using compiler 'javac'. [INFO] Toolchain in compiler-plugin: JDK[D:/IBM/SDP70/jdk] */(This is the JDK5)/* *[WARNING] Toolchains are ignored, 'executable' parameter is set to C:\glassfish3withjdk\jdk/bin/javac* It goes for JDK 6 after getting the toolchain why is it not going for the JDK that i hard coded for the 1.5 JDk in toolchains.xml Do you have any idea: I searched on google and some one said that cos there is already a JVM installed so it went for that. When i remove the JAVA_HOME from system environment as a variable then mvn.bat doesnt run cos JAVA_HOME is not set for it. So what do i do now: if i set a JAVA_HOME it falls back on it and ignores the toolchain, if i dont set the JAVA_HOME then mvn fails So what do we do: whats wrong here? Thanks in advance. Syed... -- View this message in context: http://maven.40175.n5.nabble.com/what-does-define-do-in-maven-tp5485392p5495490.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: what does --define do in maven
It is a question of itch scratching... If it is your itch, scratch it, submit a patch, and it will be done ;-) On Saturday, 18 February 2012, sarmahdi wrote: > Stephen, > > i just saw toolchain. > > for jdk yes its a good way, pretty much the same way I am doing in profiles. > It will only add one more step (or xml tree) to add a tool chain instead of > reading from properties in the compiler plugin the profile will be bound by > its own specific tool chain for the jdk. which is good too. > > it says that only four plugins are toolchain aware: > >maven-compiler-plugin-2.1 >maven-javadoc-plugin-2.5 >maven-surefire-plugin-2.5 >exec-maven-plugin-1.1.1 (Codehaus MOJO) > > I think it would be a better thing to add the SCM plugin to be tool chain > aware as well. so that we can configure a tool chain for the scm and add > them to profiles so that when we run a profile it updates from the tool > chained stream/branch and all other props in those tool chain. > > > > -- > View this message in context: http://maven.40175.n5.nabble.com/what-does-define-do-in-maven-tp5485392p5495206.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >
Re: what does --define do in maven
ahh!!! yes you are right stephen,cos POMs can be committed with the code and toolchains.xml and settings.xml are machine specific or more accurately, local maven installation specific so the POM are still portable. Hmm i guess have to go that way .. I will build profiles that use their own tool chain: SITJDK5 org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.5 1.5 org.apache.maven.plugins maven-toolchains-plugin 1.0 validate toolchain 1.5 // will use D:/IBM/SDP70/jdk/bin for jdk5.0 sun SITJDK6 org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 org.apache.maven.plugins maven-toolchains-plugin 1.0 validate toolchain 1.6 //Will use C:/glassfish3withjdk/jdk/bin for jdk 6.0 sun and then in my toolchains.xml jdk 1.5 sun default D:/IBM/SDP70/jdk jdk 1.6 sun ide C:/glassfish3withjdk/jdk Lets see if im able to accomplish it as easily as it seems . Thanks for the tips Stephen. Syed... -- View this message in context: http://maven.40175.n5.nabble.com/what-does-define-do-in-maven-tp5485392p5495256.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: what does --define do in maven
Stephen, i just saw toolchain. for jdk yes its a good way, pretty much the same way I am doing in profiles. It will only add one more step (or xml tree) to add a tool chain instead of reading from properties in the compiler plugin the profile will be bound by its own specific tool chain for the jdk. which is good too. it says that only four plugins are toolchain aware: maven-compiler-plugin-2.1 maven-javadoc-plugin-2.5 maven-surefire-plugin-2.5 exec-maven-plugin-1.1.1 (Codehaus MOJO) I think it would be a better thing to add the SCM plugin to be tool chain aware as well. so that we can configure a tool chain for the scm and add them to profiles so that when we run a profile it updates from the tool chained stream/branch and all other props in those tool chain. -- View this message in context: http://maven.40175.n5.nabble.com/what-does-define-do-in-maven-tp5485392p5495206.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: what does --define do in maven
No. Toolchains that is the way. Profiles are not best suited to that, esp when you are hardcoding paths in the profile. If you are doing Maven right, on another new PC running any of MacOS/Linux/Windows you should just need to install maven, setup your toolchains.xml and settings.xml and checkout the project and build should work first time. If you are doing Maven wrong then it won't work -Stephen On 18 February 2012 10:25, sarmahdi wrote: > thanks for the comment stephen: > > I agree, it does seem like a bootstrap or adhoc way of passing which JDK we > need to compile with: > > How ever, i made profiles. So you think making profiles is a good way or > not. > i made two profiles and gave the compiler plugin settings differently. So > when i call with -PDEVJDK5 it compiles with jdk 5 or else -PDEVJDK6 in > which case it compiles using the jdk 5 > > (I had hardcoded the jdk directory path like this ) > / > > SITJDK5 > > > > > org.apache.maven.plugins > maven-compiler-plugin > 2.3.2 > > 1.5 > 1.5 > true > true > > > D:/IBM/SDP70/jdk/bin/javac > > > > > > > > / > > > > This seemed like a decent way to me. What do you guys think, can we choose > JDK like that and run it like this : > > /mvn.bat --also-make --projects com.riyadbank:eCorp-ear clean -PSITJDK5 > install/ > > I just started reading on toolchains so dont know how it will help me. > > Thanks > Syed... > > -- > View this message in context: > http://maven.40175.n5.nabble.com/what-does-define-do-in-maven-tp5485392p5495040.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: what does --define do in maven
thanks for the comment stephen: I agree, it does seem like a bootstrap or adhoc way of passing which JDK we need to compile with: How ever, i made profiles. So you think making profiles is a good way or not. i made two profiles and gave the compiler plugin settings differently. So when i call with -PDEVJDK5 it compiles with jdk 5 or else -PDEVJDK6 in which case it compiles using the jdk 5 (I had hardcoded the jdk directory path like this ) / SITJDK5 org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.5 1.5 true true D:/IBM/SDP70/jdk/bin/javac / This seemed like a decent way to me. What do you guys think, can we choose JDK like that and run it like this : /mvn.bat --also-make --projects com.riyadbank:eCorp-ear clean -PSITJDK5 install/ I just started reading on toolchains so dont know how it will help me. Thanks Syed... -- View this message in context: http://maven.40175.n5.nabble.com/what-does-define-do-in-maven-tp5485392p5495040.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: what does --define do in maven
ASIDE: Please note that using properties is not the recommended way to pick different JDKs for building with. The recommended way is to use ~/.m2/toolchains.xml to define where your different JDKs (and other toolchains) are located, and then use the maven-toolchains-plugin to call out the specific toolchain you want maven to use for compiling your project with, running your unit tests with, etc. However, if you are just playing around to grok maven, that's OK... as long as realise that the correct way for specifying toolchains is ~/.m2/toolchains.xml ;-) On 15 February 2012 15:37, sarmahdi wrote: > Oliver: > > Did you mean that > > if i do > > *mvn compile -dexecutable=C:/glassfish3withjdk/jdk/bin/javac -dfork=true > -dsource=1.6 -dtarget=1.6 -dverbose=true > * > it will be like running the compile plugin with this configuration : > > org.apache.maven.plugins > maven-compiler-plugin > 2.3.2 > > /* 1.6 > 1.6 > true > true*/ > > > /*C:/glassfish3withjdk/jdk/bin/javac*/ > > > > > Thanks for answering tho. > > Syed... > > -- > View this message in context: > http://maven.40175.n5.nabble.com/what-does-define-do-in-maven-tp5485392p5486406.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: what does --define do in maven
Oliver: Did you mean that if i do *mvn compile -dexecutable=C:/glassfish3withjdk/jdk/bin/javac -dfork=true -dsource=1.6 -dtarget=1.6 -dverbose=true * it will be like running the compile plugin with this configuration : org.apache.maven.plugins maven-compiler-plugin 2.3.2 /* 1.6 1.6 true true*/ /*C:/glassfish3withjdk/jdk/bin/javac*/ Thanks for answering tho. Syed... -- View this message in context: http://maven.40175.n5.nabble.com/what-does-define-do-in-maven-tp5485392p5486406.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: what does --define do in maven
i did mvn -X and it gave me the info of what compiler it was using. (interestingly, same project ran under JDK 5 profile where i pointed the compiler to a JDK5 had a smaller log than JDK6).. -- View this message in context: http://maven.40175.n5.nabble.com/what-does-define-do-in-maven-tp5485392p5486299.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: what does --define do in maven
I sure am having fun !!! just made my two profiles in my POM for two different JDKs and running alternatively AWESOME!!! I still didn't get your answer tho sorry! can i define java-home thru this : like c:/ProjectDir>mvn.bat --DefineJAVA_HOME=c:/java/jdk/bin --also-make clean install -- View this message in context: http://maven.40175.n5.nabble.com/what-does-define-do-in-maven-tp5485392p5486193.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: what does --define do in maven
Hello, 2012/2/15 sarmahdi : > Hi All, > > I tried maven thorugh netBeans. As this is not the right way to learn maven > I am now running a running maven project thorugh command line > > I did mvn -h and saw some options: --define is something interesting i > think, what does it do, how can i use it and how can it help me . It's the way do define sys props tru cli (-D,--define Define a system property ) The sample is to override/define mojo/plugin property. Perso, the most I use daily are: * -Dsurefire.useFile=false (will output unit test trace in console) *-Dtest=MyTest (to run only this unit test note the support of -Dtest=MyTest#myMethod to run only this method). You must have a look at plugin documentation to see which mojo/plugin fields are configurable tru cli. In plugin site documentation http://maven.apache.org/plugins (sample http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html) Or tru cli : mvn surefire:help -Ddetail=true -Dgoal=test So welcome in the Apache Maven world and I hope you will have fun :-) > > I will appreciate if any one can give me some info. I have been googling but > i am not able to get anything on it. ha any one ever used it? > > Thanks > Syed.. > > -- > View this message in context: > http://maven.40175.n5.nabble.com/what-does-define-do-in-maven-tp5485392p5485392.html > Sent from the Maven - Users mailing list archive at Nabble.com. -- Olivier Lamy Talend: http://coders.talend.com http://twitter.com/olamy | http://linkedin.com/in/olamy - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org