You're welcome.
Good luck.
- Steev Coco.
Steven,
I too am sorry for the latency in replying... I nearly lost the response.
The mail archives at http://mail-archives.apache.org don't have a
search function, so they're practically useless.
The search tool at http://www.mail-archives.com yielded nothing for
Java-Bean so I assume it's got a huge latency.
Anyway, grepping through my own email digest archives I stumbled on
your answer just today.
The suggestion to move the template manifest file into a META-INF
directory worked.
I'll take the other manifest problems under advisement... I'm still
creating my project POMs.
Thanks.
Derrick
Subject:
Re: Java-Bean: True
From:
Steven Coco <[EMAIL PROTECTED]>
Date:
Thu, 01 Jun 2006 08:33:43 -0400
To:
[email protected]
Hello. Sorry for the long latency on this one!
It's possible that your only problem is in specifying:
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
Instead of:
<manifestFile>src/main/resources/MANIFEST.MF</manifestFile>
(Include the META-INF directory).
I general, I don't have a problem defining a manifest, and merging
it with what Maven generates. I'll include a POM below that I just
tested using Maven 2.0.4 to be sure: I created the basic Maven
archetype using archetype:create and modified the POM as you see it;
and I created the manifest shown below; and Maven packages that jar
as I would expect.
HOWEVER, while we're on this topic, I just feel I should note that
the jar and war plugins do have a different defect that might also
pose an issue for you. See issues MJAR-38
<http://jira.codehaus.org/browse/MJAR-38>, and MWAR-34
<http://jira.codehaus.org/browse/MWAR-34>; and also MJAR-39
<http://jira.codehaus.org/browse/MJAR-39> that might affect your
Jars. In summary, Maven arbitrarily adds an extension definition to
every Jar it makes -- and horribly, every War too -- so your project
is not just going to be a Bean, but an Optional Package also! I
know of no cure for this; however, it does appear that someone else
has posted a patch; but I haven't had a chance to look into it. I
have dropped the sources and attempted to make a patch, but chasing
all the dependencies and getting a workable source set and classpath
on my machine has thus far eluded me; and nothing is
well-documented! This is a bit fraught to say the least -- notice
that the combination of an Extension-Name attribute and a Main-Class
attribute means that the Main-Class is defined to be the Optional
Package's installer program. So this is essentially crazy.
Maven is also not generating the Created-By attribute according to
the intention defined in the Jar specification. Manifest handling
is very problematic.
Here's that sample POM and manifest, and good luck.
- Steven Coco.
src/main/resources/META-INF/MANIFEST.MF:
Manifest-Version: 1.0
Name: com/foo/App.class
Java-Bean: True
pom.xml:
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo</groupId>
<artifactId>jar-test</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
<index>true</index>
<manifest>
<mainClass>com/foo/App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
-- Original Message:
Derrick Oswald wrote:
Hi,
Using maven 2, how can you tag some classes in a jar as java beans?
The MANIFEST.MF file I want is (in part):
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
...<snip>
Class-Path: htmllexer.jar sax-2.0.1.jar
Name: org/htmlparser/Parser.class
Java-Bean: True
etc.
As usual, the documentation lies and says setting
<manifestFile>src/main/resources/MANIFEST.MF</manifestFile>
is an option; but that doesn't work.
I've tried guessing the usual things in the maven-jar-plugin
manifest and manifestEntries sections of the POM, but can only get
an error message like:
[INFO] Failed to configure plugin parameters for:
org.apache.maven.plugins:maven-jar-plugin:2.0
Cause: Cannot find setter nor field in
org.apache.maven.archiver.ManifestConfigu
ration for 'name'
or
[INFO] Error assembling JAR
Embedded error: Specify the section name using the "name"
attribute of the <section> element rather than using a "Name"
manifest attribute
Any help would be appreciated.
Derrick