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.


Please advice me.

Thanks,
daivish.



On Wed, Aug 10, 2011 at 4:58 PM, Barrie Treloar <baerr...@gmail.com> wrote:

> On Thu, Aug 11, 2011 at 9:01 AM, Daivish Shah <daivish.s...@gmail.com>
> wrote:
> > I'm using an ant build.xml that generates classes and compiles them with
> the
> > tools.jar from the JDK.
> >
> > I am using MAVEN 2.2.1 version. JDK 1.5 to execute MAVEN. As maven 2.2.1
> > version supports higher then JDK 1.5 only so I have to use it.
>
> You can downgrade to Maven 2.0.11
> (http://maven.apache.org/docs/2.0.11/release-notes.html) which will
> support 1.4.
>
> > This maven-antrun-plugin doesn't allow to specify neither source or
> target
> > version for the compiler.
> > So, the generated classes are compiled against the currently running JVM
> > which is JDK , using its rt.jar and the tools.jar provided in plugin
> > dependencies (or placed in the lib/ext directory of the jvm).
> >
> > As Maven is executed in a 1.5 JVM (jdk1.5.0_22) is needed for my project
> to
> > compile these classes with JDK 1.4.2 version because the server where I
> want
> > to deploy them is running on a 1.4 JVM, so I am getting exception while I
> am
> > compiling with MAVEN plugin from my eclipse or command line.
> >
> > I couldn't find a way to tell antrun to compile my classes using a
> different
> > java version.
> > I tried the following workarounds :
>
> You can upgrade WPS to use java 1.5.
>
> Or you can tell Ant to use a different version of java.
> http://ant.apache.org/manual/Tasks/javac.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to