You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by tek1 <te...@pobox.com> on 2003/06/09 04:31:37 UTC
MANIFEST.MF in .jar created by Maven? / project.properties
Hello.
Is there a way to change the properties in MANIFEST.MF that Maven generates
when creating a .jar of the project?
Also, is there any documentation on all the properties that can be set in
project.properties?
Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: MANIFEST.MF in .jar created by Maven? / project.properties
Posted by tek1 <te...@pobox.com>.
Thank you very much Alex!
I will give it a try!
At 08:55 03/06/09 -0700, you wrote:
>I ran into this problem too. You can either hack the 'maven-jar' plugin or
>you can do what I did (which is terribly hacky) and make a 'postGoal' that
>un-jars the jar you just made and re-build it with a fresh manifest like so:
>
><?xml version="1.0"?>
><project xmlns:j="jelly:core"
> xmlns:maven="jelly:maven"
> xmlns:ant="jelly:ant">
>
> <!--
> This post-goal hook was put in to replace the standard
> META-INF/MANIFEST.MF file
> that Maven generates. For some deep, dark, hidden reason the extra
> information put
> in that file, for this component, causes the PaymentException class
> to not be loaded
> by the class-loader. So we replace the noisy MANIFEST.MF file with a
> very plain one.
> -->
> <postGoal name="jar:jar">
> <ant:mkdir dir="${maven.build.dir}/temp-jar"/>
> <ant:unjar src="${maven.build.dir}/${maven.final.name}.jar"
> dest="${maven.build.dir}/temp-jar"/>
> <ant:delete dir="${maven.build.dir}/temp-jar/META-INF" quiet="true"/>
> <ant:jar destfile="${maven.build.dir}/${maven.final.name}.jar"
> basedir="${maven.build.dir}/temp-jar"
> excludes="META-INF">
> <ant:manifest>
> <ant:attribute name="Built-By" value="${user.name}"/>
> </ant:manifest>
> </ant:jar>
> <ant:delete dir="${maven.build.dir}/temp-jar"/>
> </postGoal>
></project>
>
>Gruesome isn't it? ;-)
>
>--Alex
>
>tek1 wrote:
>
>>Hello.
>>
>>Is there a way to change the properties in MANIFEST.MF that Maven
>>generates when creating a .jar of the project?
>>
>>Also, is there any documentation on all the properties that can be set
>>in project.properties?
>>
>>Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: MANIFEST.MF in .jar created by Maven? / project.properties
Posted by Alex Vollmer <al...@tenzing.com>.
I ran into this problem too. You can either hack the 'maven-jar' plugin
or you can do what I did (which is terribly hacky) and make a 'postGoal'
that un-jars the jar you just made and re-build it with a fresh manifest
like so:
<?xml version="1.0"?>
<project xmlns:j="jelly:core"
xmlns:maven="jelly:maven"
xmlns:ant="jelly:ant">
<!--
This post-goal hook was put in to replace the standard
META-INF/MANIFEST.MF file
that Maven generates. For some deep, dark, hidden reason the extra
information put
in that file, for this component, causes the PaymentException class
to not be loaded
by the class-loader. So we replace the noisy MANIFEST.MF file with a
very plain one.
-->
<postGoal name="jar:jar">
<ant:mkdir dir="${maven.build.dir}/temp-jar"/>
<ant:unjar src="${maven.build.dir}/${maven.final.name}.jar"
dest="${maven.build.dir}/temp-jar"/>
<ant:delete dir="${maven.build.dir}/temp-jar/META-INF"
quiet="true"/>
<ant:jar destfile="${maven.build.dir}/${maven.final.name}.jar"
basedir="${maven.build.dir}/temp-jar"
excludes="META-INF">
<ant:manifest>
<ant:attribute name="Built-By" value="${user.name}"/>
</ant:manifest>
</ant:jar>
<ant:delete dir="${maven.build.dir}/temp-jar"/>
</postGoal>
</project>
Gruesome isn't it? ;-)
--Alex
tek1 wrote:
> Hello.
>
> Is there a way to change the properties in MANIFEST.MF that Maven
> generates when creating a .jar of the project?
>
> Also, is there any documentation on all the properties that can be set
> in project.properties?
>
> Thank you.
>
> ---------------------------------------------------------------------
> 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: MANIFEST.MF in .jar created by Maven? / project.properties
Posted by Leo Simons <le...@apache.org>.
tek1 wrote:
> Is there a way to change the properties in MANIFEST.MF that Maven
> generates when creating a .jar of the project?
from the plugin source:
<ant:manifest>
<ant:attribute name="Built-By" value="${user.name}"/>
<ant:attribute name="Created-By" value="Apache Jakarta Maven"/>
<ant:attribute name="Package" value="${pom.package}"/>
<ant:attribute name="Build-Jdk" value="${java.version}"/>
<!-- added supplementary entries -->
<ant:attribute name="Extension-Name" value="${pom.artifactId}"/>
<ant:attribute name="Specification-Version"
value="${pom.specificationVersion}"/>
<ant:attribute name="Specification-Vendor"
value="${pom.organization.name}"/>
<ant:attribute name="Specification-Title"
value="${pom.shortDescription}"/>
<ant:attribute name="Implementation-Version"
value="${pom.currentVersion}"/>
<ant:attribute name="Implementation-Vendor"
value="${pom.organization.name}"/>
<ant:attribute name="Implementation-Vendor-Id"
value="${pom.organization.identifier}"/>
<j:set var="mainclass"
value="${pom.getPluginContext('maven-java-plugin').getVariable('maven.jar.mainclass')}"/>
<j:if test="${!empty(mainclass)}">
<ant:attribute name="Main-Class" value="${mainclass}"/>
</j:if>
<j:set var="extensionList" value=""/>
<j:forEach var="artifact" items="${pom.artifacts}">
<j:set var="dep" value="${artifact.dependency}"/>
<j:set var="extensionList"
value="${extensionList},${dep.artifactId}"/>
</j:forEach>
<j:if test="${extensionList.length() != 0}">
<j:set var="extensionList"
value="${extensionList.substring(1)}"/>
<ant:attribute name="Extension-List" value="${extensionList}"/>
</j:if>
<j:forEach var="artifact" items="${pom.artifacts}">
<j:set var="dep" value="${artifact.dependency}"/>
<ant:attribute name="${dep.artifactId}-Extension-Name"
value="${dep.artifactId}"/>
<ant:attribute name="${dep.artifactId}-Implementation-Version"
value="${dep.version}"/>
<ant:attribute name="${dep.artifactId}-Implementation-URL"
value="http://www.ibiblio.org/maven${artifact.urlPath}"/>
</j:forEach>
</ant:manifest>
everything between ${} you can (potentially) modify; not that you'd
normally want to. In addition, you can specify a completely different
manifest or add "extension" manifest entries, see:
http://maven.apache.org/reference/plugins/jar/properties.html
> Also, is there any documentation on all the properties that can be set
> in project.properties?
http://maven.apache.org/reference/plugins/index.html
list most properties you can set for most plugins; the user guide lists
the most common ones. Failing that, browse
http://cvs.apache.org/viewcvs.cgi/maven/src/plugins-build/ for
project.properties and plugin.properties files. You can override all of
those.
cheers,
- Leo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org