HI Stephen, Use http://mojo.codehaus.org/exec-maven-plugin/exec-mojo.html to run ANT and you can provide the ENV variables to your hearts content.
For this can you give me example how can i setup JAVA_HOME by using exec-maven-plugin ? I think I can apply "ant -f WPSEjb_build.xml build" command in this plugin. But please let me know how can i setup My JAVA_HOME here ? Thanks for your help Stephen. thanks, daivish. On Thu, Aug 11, 2011 at 9:10 AM, Stephen Connolly < stephen.alan.conno...@gmail.com> wrote: > Use http://mojo.codehaus.org/exec-maven-plugin/exec-mojo.html to run > ANT and you can provide the ENV variables to your hearts content. > > Or use the http://ant.apache.org/manual/Tasks/exec.html to fork ANT > with the correct environment variables set. > > On 11 August 2011 17:06, Daivish Shah <daivish.s...@gmail.com> wrote: > > Hi Barrie, > > > > I can't apply JAVAC in my BUILD.XML as i am using Weblogic Workshop > related > > .WORK file under my build.xml and there is no way to specify JAVAC for > this > > wlwBuild Command. > > > > My code for build.xml is something like this. > > > > > > <?xml version="1.0" encoding="UTF-8" ?> > > <project name="WLW build" default="build"> > > > > <property file="local.properties" /> > > <property file="reference.properties" /> > > > > <property name="app.source.dir" value="C:\WPS" /> > > <property name="work.file" value="WPS.work" /> > > <property name="output.dir" value="C:\TEST" /> > > <property name="server.classpath" > > > value="${java.home}/jre/lib/rt.jar;${java.home}/lib/tools.jar;${weblogic.home}/server/lib/knex.jar;${weblogic.home}/common/lib/log4j.jar;${weblogic.home}/server/lib/debugging.jar;${weblogic.home}/javelin/lib/javelin.jar;${weblogic.home}/server/lib/wlw-lang.jar;${weblogic.home}/server/lib/weblogic.jar;${weblogic.home}/common/eval/pointbase/lib/pbserver44.jar;${weblogic.home}/common/eval/pointbase/lib/pbclient44.jar;${weblogic.home}/server/lib/webservices.jar;${weblogic.home}/server/lib/webserviceclient.jar;${weblogic.home}/server/lib/webserviceclient+ssl.jar;${weblogic.home}/server/lib/wli.jar;${weblogic.home}/server/lib/xbean.jar;${weblogic.home}/server/lib/wlxbean.jar;${weblogic.home}/server/lib/xqrl.jar;${weblogic.home}/server/lib/netui/netui-compiler.jar;${mit.classpath}"/> > > <property environment="env" /> > > <property name="java.home" value="C:\bea\jdk142_04"/> > > <taskdef name="wlwBuild" classname="workshop.core.WlwBuildTask" > > classpath="${weblogic.home}/workshop/wlw-ide.jar"/> > > > > <!--target name="wbuild" depends="init"--> > > <target name="build" depends="wbuild"/> > > > > <target name="wbuild" > > > <echo message="SourceDirectory=${app.source.dir}/${work.file}"/> > > <echo message="output.dir=${output.dir}"/> > > <echo message="server.classpath=${server.classpath}"/> > > <echo message="env.JAVA_HOME=${env.JAVA_HOME}"/> > > > > <wlwBuild work="${app.source.dir}/${work.file}" > > serverclasspath="${server.classpath}"> > > <build project="WPSEjb"/> > > </wlwBuild> > > </target> > > </project> > > > > I can't use this plugin > > http://mojo.codehaus.org/exec-maven-plugin/index.html As i have > limitation > > to USE <wlwBuild command from Build.xml as this is the only command which > > generated my class files with all information in .WORK file of my > project. > > > > > > So i am not sure how can i apply MAVEN ANT Plugin to compile with java > > version 1.4.2, I am really struggling to get the answer on this. And i am > > stuck here. > > > > But i assume that you can provide compiler information in > > maven-antrun-plugin to execute your build.xml which is not possible with > > plugin. That's real limitation to use this plugin i guess. > > > > Please advice me some work around for my problem. > > > > Thanks, > > daivish. > > > > > > > > > > On Wed, Aug 10, 2011 at 11:09 PM, Anders Hammar <and...@hammar.net> > wrote: > > > >> I agree with Stephen. The issues come from the fact that the ant job > does > >> too much, i.e. both generates the classes and compiles them. I have had > my > >> fair share of these issues using tools in Maven which originated from > Ant > >> land. Maven has a different approach. > >> One possible half-way approach is to stay with the antrun plugin to > >> generate > >> the Java classes and bind that to the correct phase, and then use the > >> compiler plugin to compile them. (But do understand that this will still > >> cause you headache should you try to use m2eclipse v1.0+, as it will not > >> know how to treat the antrun execution. It is then much better to have > >> specific plugin for the code generation.) > >> > >> /Anders > >> > >> On Thu, Aug 11, 2011 at 07:45, Stephen Connolly < > >> stephen.alan.conno...@gmail.com> wrote: > >> > >> > sounds like he'd be better off pitching the ant build for a full maven > >> > build > >> > and using toolchains to get m-compiler-p compiling with 1.4... or > >> pitching > >> > maven and using ant. > >> > > >> > - Stephen > >> > > >> > --- > >> > Sent from my Android phone, so random spelling mistakes, random > nonsense > >> > words and other nonsense are a direct result of using swype to type on > >> the > >> > screen > >> > On 11 Aug 2011 05:23, "Barrie Treloar" <baerr...@gmail.com> wrote: > >> > > On Thu, Aug 11, 2011 at 9:47 AM, Daivish Shah < > daivish.s...@gmail.com> > >> > wrote: > >> > >> Hi, > >> > >> > >> > >> I tried giving JRE and TOOLS JAR from build.xml file. But it's > working > >> > fine > >> > >> if i run as ANT script. > >> > >> > >> > >> But when i execute as MAVEN it's taking JAVA_HOME variable which is > >> > setup > >> > as > >> > >> system variable so my system JAVA_HOME is 1.5 and i want to compile > >> with > >> > >> 1.4.2 from MAVEN Only. > >> > >> > >> > >> Even i gave dependencies as below. > >> > >> > >> > >> <dependencies> > >> > >> <dependency> > >> > >> <groupId>sun.jdk</groupId> > >> > >> <artifactId>tools</artifactId> > >> > >> <version>1.4.2</version> > >> > >> <scope>system</scope> > >> > >> > >> > <systemPath>${java.home}/lib/tools.jar</systemPath> > >> > >> </dependency> > >> > >> <dependency> > >> > >> <groupId>com.sun</groupId> > >> > >> <artifactId>rt</artifactId> > >> > >> <version>1.4.2</version> > >> > >> <scope>system</scope> > >> > >> > >> > <systemPath>${java.home}/jre/lib/rt.jar</systemPath> > >> > >> </dependency> > >> > >> </dependencies> > >> > >> > >> > >> > >> > >> And Also tried giving something like this. > >> > >> > >> > >> <configuration> > >> > >> <javaHome>${java.home}</javaHome> > >> > >> <source>${java-version}</source> > >> > >> <target>1.4.2</target> > >> > >> </configuration> > >> > >> > >> > >> But it's still taking JDK 1.5 while compiling the source Code. > >> > > > >> > > Ant is just a java program. > >> > > It doesn't use classpath dependencies or environment variables in > >> > > order to run. > >> > > Yes they are set in the bat files that startup Ant but not the java > >> Main > >> > class. > >> > > Ant expects all this stuff to be already available, so attempting to > >> > > get maven-antrun-plugin to inject these into the instance of Ant and > >> > > expecting it to work is a misunderstanding. > >> > > > >> > > Did you try any of the options I previously proposed? > >> > > > >> > > Another option is to just use the exec-maven-plugin > >> > > (http://mojo.codehaus.org/exec-maven-plugin) to exec Ant. > >> > > But then why are bothering to wrap all this in Maven? > >> > > > >> > > > --------------------------------------------------------------------- > >> > > 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 > >