You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Russell, Mark" <Ma...@csgsystems.com> on 2005/10/13 17:31:29 UTC

[m2] maven-jar-plugin support for manifest sections (patch)

Wasn't real sure where to send this but figured the dev list was the best place to start.

While working on converting the build process of some of the applications I work on I found that I needed to be able to add sections to the manifest.  Currently the maven-jar-plugin doesn't support this except by using an externally defined file and pointing the plugin to the file.  I personally prefer to have it all in the pom so it's in one place.  So I started to look into the code and realized that it should be a very simple thing to add support for.

As I don't think the list supports attachments a zip file containing all of my changes can be found at http://arctic-wolf.net/ManifestSectionSupportChanges.zip

In the zip file I have included my modified versions of the MavenArchiveConfiguration.java and MavenArchiver.java files, along with a .patch to simplify including the changes.  Additionally, one new class found in the ManifestSection.java file is also included.  Lastly, I have included a pom.xml that shows an example of how the changes would be used.

The fix was really quite simple, but if there is anything else needed let me know, especially if it will improve the changes of the patch being included in time for 2.0 final.

Thanks,

Mark Russell



Below you will find a simple example based on the my-app example in the maven source. (obviously modified to use the new feature)


USAGE EXAMPLE
==============================

pom.xml
=======
<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <mainClass>org.com.foo.App</mainClass>
              <packageName>org.com.foo.app</packageName>
            </manifest>
            <manifestEntries>
              <mode>development</mode>
              <url>${pom.url}</url>
            </manifestEntries>
            <manifestSections>
              <manifestSection>
                <name>SampleSectionNumberOne</name>
                <manifestEntries>
                  <mode>development</mode>
                  <url>${pom.url}</url>
                </manifestEntries>
              </manifestSection>
              <manifestSection>
                <name>SampleSectionNumberTwo</name>
                <manifestEntries>
                  <mode>development</mode>
                  <url>${pom.url}</url>
                </manifestEntries>
              </manifestSection>
            </manifestSections>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...
</project>


Resulting MANIFEST.MF
======================
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: RUSM01
Package: org.com.foo.app
Build-Jdk: 1.4.2_08
Extension-Name: my-app
Specification-Vendor: MyCompany Inc
Implementation-Vendor: MyCompany Inc
Implementation-Title: my-app
Implementation-Version: 1.0-SNAPSHOT
Main-Class: org.com.foo.App
mode: development
url: http://maven.apache.org

Name: SampleSectionNumberOne
mode: development
url: http://maven.apache.org

Name: SampleSectionNumberTwo
mode: development
url: http://maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [m2] maven-jar-plugin support for manifest sections (patch)

Posted by Jason van Zyl <ja...@maven.org>.
On Thu, 2005-10-13 at 09:31 -0600, Russell, Mark wrote:
> Wasn't real sure where to send this but figured the dev list was the best place to start.

Have you seen this:

http://people.apache.org/~jvanzyl/maven2/guides/mini/guide-manifest.html

-- 
jvz.

Jason van Zyl
jason at maven.org
http://maven.apache.org

Our achievements speak for themselves. What we have to keep track
of are our failures, discouragements and doubts. We tend to forget
the past difficulties, the many false starts, and the painful
groping. We see our past achievements as the end result of a
clean forward thrust, and our present difficulties as
signs of decline and decay.

 -- Eric Hoffer, Reflections on the Human Condition


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org