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

Reply via email to