You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Severin Ecker <se...@gmx.at> on 2007/07/10 09:11:50 UTC
Default java source version
Hi,
i was wondering if i can change de default java source and target
version for the compiler plugin to let's say 1.5 oder 1.6 globally in
the settings.xml (or somewhere else), and only override it in the pom
file if i need an older version.
thanks!
cheers,
severin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Default java source version
Posted by Jochen Wiedmann <jo...@gmail.com>.
On 7/10/07, Severin Ecker <se...@gmx.at> wrote:
> i was wondering if i can change de default java source and target
> version for the compiler plugin to let's say 1.5 oder 1.6 globally in
> the settings.xml (or somewhere else), and only override it in the pom
> file if i need an older version.
Create a profile in your settings with activeByDefault=true. In that
profile, add a section build/plugins/plugin for the
maven-compiler-plugin and configure it appropriately.
Jochen
--
"Besides, manipulating elections is under penalty of law, resulting in
a preventative effect against manipulating elections.
The german government justifying the use of electronic voting machines
and obviously believing that we don't need a police, because all
illegal actions are forbidden.
http://dip.bundestag.de/btd/16/051/1605194.pdf
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Default java source version
Posted by Severin Ecker <se...@gmx.at>.
hi,
sry trevor, i mis-replied there ;)
Heinrich Nirschl wrote:
> Severin,
>
> it's generally not a good idea to separate this information from the
> POM. It would make it harder to reproduce a build. Each member of the
> development team would get different results if not all have the same
> settings configuration.
>
> - Henry
>
indeed that's probably not a good idea. but then again why is there a
default value in the first place, one that's definitely been thought
about (otherwise it would be 1.0 or some), and why can't i change that
default (well i can it's just not documented anywhere else but the
source...)
so, if anyone's interested, checking said source i found out that one
has to add the following to the profile one's using for a project:
<profiles>
<profile>
<properties>
<maven.compiler.source>1.x</maven.compiler.source>
<maven.compiler.target>1.x</maven.compiler.target>
</properties>
</profile>
</profiles>
cheers,
severin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Default java source version
Posted by Trevor Spackman <ts...@myriad.com>.
Sent to the list...
-----Original Message-----
From: Severin Ecker [mailto:secker@gmx.at]
Sent: Tuesday, July 10, 2007 10:59 AM
To: Trevor Spackman
Subject: Re: Default java source version
yes i could do that. thing is, many of my/our projects are unrelated and
shouldn't have a common parent, i only wanted to change the default
value of 1.3 to 1.5 or 1.6 but it seems that is is not possible without
changing the compiler plugin source... oh well.
thanks everyone.
cheers,
severin
Trevor Spackman wrote:
> We handled this problem by creating a parent POM that all of our
> projects inherit from with the following:
>
> <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.5</source>
> <target>1.5</target>
> </configuration>
> </plugin>
>
> Then in the individual project you add:
>
> <parent>
> <artifactId>parent-artifact-name</artifactId>
> <groupId>com.my.group</groupId>
> <version>1.0</version>
> </parent>
>
> In a couple of projects, we needed to use 1.6 instead of 1.5, so then
> you have to override the settings in a given child pom:
>
> <build>
> <plugins>
> <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.6</source>
> <target>1.6</target>
> <fork>true</fork>
> <executable>${JAVA_1_6_HOME}/bin/javac</executable>
> <compilerVersion>1.6</compilerVersion>
> </configuration>
> </plugin>
> </plugins>
> </build>
>
> Where JAVA_1_6_HOME is an environment variable that provides the
home
> of
> a different java version.
>
> HTH,
> Trevor
>
>
> -----Original Message-----
> From: Severin Ecker [mailto:secker@gmx.at]
> Sent: Tuesday, July 10, 2007 7:39 AM
> To: Maven Users List
> Subject: Re: Default java source version
>
> hi jason,
>
> yes i know that and i have that section in my POM. what i want is to
> override the default of java 1.3 so i don't have to do that in all my
> project POM files which is tedious. that's why i was asking for a way
to
>
> configure it in the settings.xml.
>
> i suppose 1.3 is not hardcoded and can be changed via some property or
> some other configuration... no?
>
> cheers,
> severin
>
>
> Ferguson, Jason M TSgt 375 CSPTS/SCE wrote:
>
>> This particular bit of configuration is your friend. Put it in the
>> <plugins> section of your POM:
>>
>> <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-compiler-plugin</artifactId>
>> <configuration>
>> <source>1.5</source>
>> <target>1.5</target>
>> </configuration>
>> </plugin>
>>
>> (I forgot to put it in yesterday and kept getting messages that
>>
> -source
>
>> 1.3 did not support generics and annotations).
>>
>> Jason
>>
>> -----Original Message-----
>> From: Severin Ecker [mailto:secker@gmx.at]
>> Sent: Tuesday, July 10, 2007 2:12 AM
>> To: Maven Users List
>> Subject: Default java source version
>>
>> Hi,
>>
>> i was wondering if i can change de default java source and target
>> version for the compiler plugin to let's say 1.5 oder 1.6 globally in
>> the settings.xml (or somewhere else), and only override it in the pom
>> file if i need an older version.
>>
>> thanks!
>> cheers,
>> severin
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Default java source version
Posted by Trevor Spackman <ts...@myriad.com>.
We handled this problem by creating a parent POM that all of our
projects inherit from with the following:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
Then in the individual project you add:
<parent>
<artifactId>parent-artifact-name</artifactId>
<groupId>com.my.group</groupId>
<version>1.0</version>
</parent>
In a couple of projects, we needed to use 1.6 instead of 1.5, so then
you have to override the settings in a given child pom:
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<fork>true</fork>
<executable>${JAVA_1_6_HOME}/bin/javac</executable>
<compilerVersion>1.6</compilerVersion>
</configuration>
</plugin>
</plugins>
</build>
Where JAVA_1_6_HOME is an environment variable that provides the home
of
a different java version.
HTH,
Trevor
-----Original Message-----
From: Severin Ecker [mailto:secker@gmx.at]
Sent: Tuesday, July 10, 2007 7:39 AM
To: Maven Users List
Subject: Re: Default java source version
hi jason,
yes i know that and i have that section in my POM. what i want is to
override the default of java 1.3 so i don't have to do that in all my
project POM files which is tedious. that's why i was asking for a way to
configure it in the settings.xml.
i suppose 1.3 is not hardcoded and can be changed via some property or
some other configuration... no?
cheers,
severin
Ferguson, Jason M TSgt 375 CSPTS/SCE wrote:
> This particular bit of configuration is your friend. Put it in the
> <plugins> section of your POM:
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.5</source>
> <target>1.5</target>
> </configuration>
> </plugin>
>
> (I forgot to put it in yesterday and kept getting messages that
-source
> 1.3 did not support generics and annotations).
>
> Jason
>
> -----Original Message-----
> From: Severin Ecker [mailto:secker@gmx.at]
> Sent: Tuesday, July 10, 2007 2:12 AM
> To: Maven Users List
> Subject: Default java source version
>
> Hi,
>
> i was wondering if i can change de default java source and target
> version for the compiler plugin to let's say 1.5 oder 1.6 globally in
> the settings.xml (or somewhere else), and only override it in the pom
> file if i need an older version.
>
> thanks!
> cheers,
> severin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Default java source version
Posted by Thierry Lach <th...@gmail.com>.
What about creating a global parent pom containing the 1.5 config?
On 7/10/07, Severin Ecker <se...@gmx.at> wrote:
>
> hi jason,
>
> yes i know that and i have that section in my POM. what i want is to
> override the default of java 1.3 so i don't have to do that in all my
> project POM files which is tedious. that's why i was asking for a way to
> configure it in the settings.xml.
>
> i suppose 1.3 is not hardcoded and can be changed via some property or
> some other configuration... no?
>
> cheers,
> severin
>
>
> Ferguson, Jason M TSgt 375 CSPTS/SCE wrote:
> > This particular bit of configuration is your friend. Put it in the
> > <plugins> section of your POM:
> >
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-compiler-plugin</artifactId>
> > <configuration>
> > <source>1.5</source>
> > <target>1.5</target>
> > </configuration>
> > </plugin>
> >
> > (I forgot to put it in yesterday and kept getting messages that -source
> > 1.3 did not support generics and annotations).
> >
> > Jason
> >
> > -----Original Message-----
> > From: Severin Ecker [mailto:secker@gmx.at]
> > Sent: Tuesday, July 10, 2007 2:12 AM
> > To: Maven Users List
> > Subject: Default java source version
> >
> > Hi,
> >
> > i was wondering if i can change de default java source and target
> > version for the compiler plugin to let's say 1.5 oder 1.6 globally in
> > the settings.xml (or somewhere else), and only override it in the pom
> > file if i need an older version.
> >
> > thanks!
> > cheers,
> > severin
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Default java source version
Posted by Severin Ecker <se...@gmx.at>.
hi jason,
yes i know that and i have that section in my POM. what i want is to
override the default of java 1.3 so i don't have to do that in all my
project POM files which is tedious. that's why i was asking for a way to
configure it in the settings.xml.
i suppose 1.3 is not hardcoded and can be changed via some property or
some other configuration... no?
cheers,
severin
Ferguson, Jason M TSgt 375 CSPTS/SCE wrote:
> This particular bit of configuration is your friend. Put it in the
> <plugins> section of your POM:
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.5</source>
> <target>1.5</target>
> </configuration>
> </plugin>
>
> (I forgot to put it in yesterday and kept getting messages that -source
> 1.3 did not support generics and annotations).
>
> Jason
>
> -----Original Message-----
> From: Severin Ecker [mailto:secker@gmx.at]
> Sent: Tuesday, July 10, 2007 2:12 AM
> To: Maven Users List
> Subject: Default java source version
>
> Hi,
>
> i was wondering if i can change de default java source and target
> version for the compiler plugin to let's say 1.5 oder 1.6 globally in
> the settings.xml (or somewhere else), and only override it in the pom
> file if i need an older version.
>
> thanks!
> cheers,
> severin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Default java source version
Posted by "Ferguson, Jason M TSgt 375 CSPTS/SCE" <ja...@scott.af.mil>.
This particular bit of configuration is your friend. Put it in the
<plugins> section of your POM:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
(I forgot to put it in yesterday and kept getting messages that -source
1.3 did not support generics and annotations).
Jason
-----Original Message-----
From: Severin Ecker [mailto:secker@gmx.at]
Sent: Tuesday, July 10, 2007 2:12 AM
To: Maven Users List
Subject: Default java source version
Hi,
i was wondering if i can change de default java source and target
version for the compiler plugin to let's say 1.5 oder 1.6 globally in
the settings.xml (or somewhere else), and only override it in the pom
file if i need an older version.
thanks!
cheers,
severin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org