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:[EMAIL PROTECTED] 
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:[EMAIL PROTECTED] 
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to