You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-dev@incubator.apache.org by Zemian Deng <sa...@gmail.com> on 2012/07/24 15:51:35 UTC

How to change the compiler target/source version?

Hello list,

I just found your EasyAnt project, and I think it's pretty awsome. I've
been looking for something like this in a while. So thank you for providing
this project to the community. I truely wish it will adapt by more users
and move it to a top level Apache project. (I think the original ant should
really have included! ^_^)

Anyrate, here is my first question: If I have a simple std-java project,
how do I change the javac compiler's target/source value? For example, I
have JDK7 installed, but I want the resulting jar to be 1.6 compatible.

Thanks,
Zemian Deng

Re: How to change the compiler target/source version?

Posted by Zemian Deng <sa...@gmail.com>.
Excellent, this works for me:
            <ea:property name="compile.java.target.version" value="1.6"/>
            <ea:property name="compile.java.source.version" value="1.6"/>

Yeah, having those plugin docs online (or the command line option) would
help a lot. :)

Thanks,
~ Zemian

On Tue, Jul 24, 2012 at 3:46 PM, Jean-Louis Boudart <
jeanlouis.boudart@gmail.com> wrote:

> I forgot to mention that while migrating to apache we lost all our plugin
> documentation.
> Those two properties was described there.
>
>
> We will bring back to life plugin documentation soon.
>
> Note : in the next release you'll also be able to ask easyant
> easyant -listProps : will list all propreties that you can customize in
> your project
> easyant -listProps compile-java : will list all propreties from
> compile-java plugin that you can customize in your project
> easyant -describe a-property : will display documentation about a given
> property.
>
>
> Some of this command are already accessible in easyant 0.8 but if i
> remember correctly "-listProps" argument was buggy ;)
>
> 2012/7/24 Jean-Louis Boudart <je...@gmail.com>
>
> > Hello,
> >
> > Thanks for this encouraging message :).
> >
> > As you are targeting a simple std-java project i would recommend you to
> > use the build-std-java buildtype. A buildtype is a set of plugins,
> > preconfigured to answer a use case.
> >
> > This buildtype will for example import "compile-java" plugin which is
> > designed to compile java classes.
> > Fortunatly you have lot of options that you can configure. Most of them
> > are properties.
> >
> > Two key properties that may fit your need :
> >
> >    -
> >
> >    compile.java.target.version : Specify a VM version for Generated
> class files (e.g., 1.1 or 1.2).
> >
> >    -
> >
> >    compile.java.source.version : Specify a value of the -source
> command-line switch; will be ignored by all implementations prior to
> javac1.4 (or modern when Ant is not running in a 1.3 VM) and jikes.
> >
> >
> >
> > So your module.ivy file should contain
> >
> > <ea:build organisation="org.apache.easyant.buildtypes"
> module="build-std-java" revision="0.2">
> >   <ea:property name="compile.java.target.version" value="1.6"/>
> >
> >   <ea:property name="compile.java.source.version" value="1.6"/>
> > </ea:build>
> >
> > Or if you're using trunk version you can have a shortcut version using
> > dynamic attributes ;)
> >
> > <ea:build organisation="org.apache.easyant.buildtypes"
> module="build-std-java" revision="0.2"
> >
> >    compile.java.target.version="1.6"
> >    compile.java.source.version="1.6"/>
> > Both should work in future release :)
> >
> > Hope that helps
> >
> > Cheers,
> >
> >
> > 2012/7/24 Zemian Deng <sa...@gmail.com>
> >
> >> Hello list,
> >>
> >> I just found your EasyAnt project, and I think it's pretty awsome. I've
> >> been looking for something like this in a while. So thank you for
> >> providing
> >> this project to the community. I truely wish it will adapt by more users
> >> and move it to a top level Apache project. (I think the original ant
> >> should
> >> really have included! ^_^)
> >>
> >> Anyrate, here is my first question: If I have a simple std-java project,
> >> how do I change the javac compiler's target/source value? For example, I
> >> have JDK7 installed, but I want the resulting jar to be 1.6 compatible.
> >>
> >> Thanks,
> >> Zemian Deng
> >>
> >
> >
> >
> > --
> > Jean Louis Boudart
> > Independent consultant
> > Apache EasyAnt commiter http://incubator.apache.org/easyant/
> >
>
>
>
> --
> Jean Louis Boudart
> Independent consultant
> Apache EasyAnt commiter http://incubator.apache.org/easyant/
>

Re: How to change the compiler target/source version?

Posted by Jean-Louis Boudart <je...@gmail.com>.
I forgot to mention that while migrating to apache we lost all our plugin
documentation.
Those two properties was described there.


We will bring back to life plugin documentation soon.

Note : in the next release you'll also be able to ask easyant
easyant -listProps : will list all propreties that you can customize in
your project
easyant -listProps compile-java : will list all propreties from
compile-java plugin that you can customize in your project
easyant -describe a-property : will display documentation about a given
property.


Some of this command are already accessible in easyant 0.8 but if i
remember correctly "-listProps" argument was buggy ;)

2012/7/24 Jean-Louis Boudart <je...@gmail.com>

> Hello,
>
> Thanks for this encouraging message :).
>
> As you are targeting a simple std-java project i would recommend you to
> use the build-std-java buildtype. A buildtype is a set of plugins,
> preconfigured to answer a use case.
>
> This buildtype will for example import "compile-java" plugin which is
> designed to compile java classes.
> Fortunatly you have lot of options that you can configure. Most of them
> are properties.
>
> Two key properties that may fit your need :
>
>    -
>
>    compile.java.target.version : Specify a VM version for Generated class files (e.g., 1.1 or 1.2).
>
>    -
>
>    compile.java.source.version : Specify a value of the -source command-line switch; will be ignored by all implementations prior to javac1.4 (or modern when Ant is not running in a 1.3 VM) and jikes.
>
>
>
> So your module.ivy file should contain
>
> <ea:build organisation="org.apache.easyant.buildtypes" module="build-std-java" revision="0.2">
>   <ea:property name="compile.java.target.version" value="1.6"/>
>
>   <ea:property name="compile.java.source.version" value="1.6"/>
> </ea:build>
>
> Or if you're using trunk version you can have a shortcut version using
> dynamic attributes ;)
>
> <ea:build organisation="org.apache.easyant.buildtypes" module="build-std-java" revision="0.2"
>
>    compile.java.target.version="1.6"
>    compile.java.source.version="1.6"/>
> Both should work in future release :)
>
> Hope that helps
>
> Cheers,
>
>
> 2012/7/24 Zemian Deng <sa...@gmail.com>
>
>> Hello list,
>>
>> I just found your EasyAnt project, and I think it's pretty awsome. I've
>> been looking for something like this in a while. So thank you for
>> providing
>> this project to the community. I truely wish it will adapt by more users
>> and move it to a top level Apache project. (I think the original ant
>> should
>> really have included! ^_^)
>>
>> Anyrate, here is my first question: If I have a simple std-java project,
>> how do I change the javac compiler's target/source value? For example, I
>> have JDK7 installed, but I want the resulting jar to be 1.6 compatible.
>>
>> Thanks,
>> Zemian Deng
>>
>
>
>
> --
> Jean Louis Boudart
> Independent consultant
> Apache EasyAnt commiter http://incubator.apache.org/easyant/
>



-- 
Jean Louis Boudart
Independent consultant
Apache EasyAnt commiter http://incubator.apache.org/easyant/

Re: How to change the compiler target/source version?

Posted by Jean-Louis Boudart <je...@gmail.com>.
Hello,

Thanks for this encouraging message :).

As you are targeting a simple std-java project i would recommend you to use
the build-std-java buildtype. A buildtype is a set of plugins,
preconfigured to answer a use case.

This buildtype will for example import "compile-java" plugin which is
designed to compile java classes.
Fortunatly you have lot of options that you can configure. Most of them are
properties.

Two key properties that may fit your need :

   -

   compile.java.target.version : Specify a VM version for Generated
class files (e.g., 1.1 or 1.2).

   -

   compile.java.source.version : Specify a value of the -source
command-line switch; will be ignored by all implementations prior to
javac1.4 (or modern when Ant is not running in a 1.3 VM) and jikes.



So your module.ivy file should contain

<ea:build organisation="org.apache.easyant.buildtypes"
module="build-std-java" revision="0.2">
  <ea:property name="compile.java.target.version" value="1.6"/>
  <ea:property name="compile.java.source.version" value="1.6"/>
</ea:build>

Or if you're using trunk version you can have a shortcut version using
dynamic attributes ;)

<ea:build organisation="org.apache.easyant.buildtypes"
module="build-std-java" revision="0.2"
   compile.java.target.version="1.6"
   compile.java.source.version="1.6"/>
Both should work in future release :)

Hope that helps

Cheers,


2012/7/24 Zemian Deng <sa...@gmail.com>

> Hello list,
>
> I just found your EasyAnt project, and I think it's pretty awsome. I've
> been looking for something like this in a while. So thank you for providing
> this project to the community. I truely wish it will adapt by more users
> and move it to a top level Apache project. (I think the original ant should
> really have included! ^_^)
>
> Anyrate, here is my first question: If I have a simple std-java project,
> how do I change the javac compiler's target/source value? For example, I
> have JDK7 installed, but I want the resulting jar to be 1.6 compatible.
>
> Thanks,
> Zemian Deng
>



-- 
Jean Louis Boudart
Independent consultant
Apache EasyAnt commiter http://incubator.apache.org/easyant/