Hi Sebastian,

sebb wrote:

> On 20 January 2011 20:13, Dennis Lundberg <denn...@apache.org> wrote:
>> On 2011-01-20 21:05, Gary Gregory wrote:
>>>> -----Original Message-----
>>>> From: Dennis Lundberg [mailto:denn...@apache.org]
>>>> Sent: Thursday, January 20, 2011 14:59
>>>> To: Commons Developers List
>>>> Subject: Re: [site][commons-parent] Build with Maven 2 and 3.
>>>>
>>>> On 2011-01-20 17:45, Gary Gregory wrote:
>>>>> Hi All,
>>>>>
>>>>> I recently added a profile to commons-parent that allows a build to
>>>>> use
>>>> the Maven site 2.x plugin on Maven 2.x and Maven site 3.x plugin on
>>>> Maven 3.x.
>>>>>
>>>>> I just got [codec] to build both ways using this profile (in codec's
>>>> POM.)
>>>>>
>>>>> I had to override a couple of things in codec's pom.xml. I would like
>>>>> to
>>>> push these changes up to commons-parent:
>>>>>
>>>>>
>>>>> -          maven-site-plugin 2.0.1 -> 2.2
>>>>>
>>>>> -          maven-project-info-reports-plugin 2.1.2 -> 2.3.1
>>>>>
>>>>> Thoughts?
>>>>
>>>> +1 for the change
>>>>
>>>> Note that this will require at least Maven 2.2.0, which in practice
>>>> means Maven 2.2.1. That in turn requires Java 5. These requirements are
>>>> for running Maven with the plugins mentioned above.
>>>
>>> Yes indeed. And don't forget your passport to the 21st century! :)
>>>
>>> IMO, requiring Java 5 to build is a more than reasonable requirement.
>>
>> Yes, I totally agree.
>> I just wanted to point it out in case someone encounters problems.
> 
> We added the Java version profiles specifically so Maven could be run
> using whatever Java version was needed, whilst still allowing both
> compilation and testing to use a different version of Java.
> 
> AFAIK the only possible issue with this is that the jar manifests are
> built using the Maven Java details, not the compiler Java version
> details.
> It would be nice to fix this; but I've no idea if that's possible.

You can overwrite individual default entries with own ones. We configured in 
your company:

========= %< ==============
 <plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-jar-plugin</artifactId>
   <version>${version.org.apache.maven.plugins.jar}</version>
   <configuration>
     <archive>
       <addMavenDescriptor>false</addMavenDescriptor>
       <manifest>
         <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
         <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
       </manifest>
       <manifestEntries>
         <Specification-Version>${project.info.majorVersion}.
${project.info.minorVersion}</Specification-Version>
         <X-Compile-Source>${java.version.source}</X-Compile-Source>
         <X-Compile-Target>${java.version.target}</X-Compile-Target>
         <X-Builder>Maven ${maven.version}</X-Builder>
         <X-BuildTime>${maven.build.timestamp}</X-BuildTime>
       </manifestEntries>
     </archive>
   </configuration>
 </plugin>
========= %< ==============

Which produces something like:

========= %< ==============
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: 1.6.0_23 (Sun Microsystems Inc.)
Built-By: joehni
Build-Jdk: 1.6.0_23
Specification-Title: Our Project
Specification-Vendor: Our Company
Implementation-Title: Our Project
Implementation-Version: 2.3.0-SNAPSHOT
Implementation-Vendor-Id: com.company
Implementation-Vendor: Our Company
Specification-Version: 2.3
X-BuildTime: 2011-01-17T17:56 CET
X-Builder: Maven 3.0.2
X-Compile-Source: 1.6
X-Compile-Target: 1.6
========= %< ==============

Recognize the entry for the Specification-Version that is not the default 
one normally added. I am quite sure, it is possible to overwrite "Created-
By" and especially "Build-Jdk" also. 


Just in case your're interested where the values for the variables above all 
came from: They are setup with the build-helper-maven-plugin that is added 
in our company POM to the build section i.e. the variables are available in 
all our projects automatically:

========= %< ==============
 <plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>build-helper-maven-plugin</artifactId>
   <executions>
     <execution>
       <id>versions</id>
       <phase>generate-resources</phase>
       <goals>
         <goal>maven-version</goal>
         <goal>parse-version</goal>
       </goals>
       <configuration>
         <propertyPrefix>project.info</propertyPrefix>
       </configuration>
     </execution>
   </executions>
 </plugin>
========= %< ==============

I already proposed some months ago the change for the specification version 
to such a x.y pattern, since it may not contain normally any alphabetical 
character (-SNAPSHOT violates the spec) and because we keep binary 
compatibility for minor releases, but I got no reaction on the list.

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to