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
> >
>

Reply via email to