Is there a plugin that allows me to modify existing jar manifest?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there a plugin that allows me to modify existing jar manifest?

Eric B
I'm looking to modify an existing third-party JAR's Manifest file in my
maven build.  Specifically, I have an Applet which has a dependency on
these third party jars, and need to add some entries/permissions to the
Manifest before I sign them for my Applet to use.

I'm looking to add the following:

                           <Permissions>all-permissions</Permissions>
                            <Codebase>*</Codebase>

<Application-Library-Allowable-Codebase>*</Application-Library-Allowable-Codebase>
                            <Trusted-Library>true</Trusted-Library>
                            <Application-Name>MyApp</Application-Name>

<Caller-Allowable-Codebase>*</Caller-Allowable-Codebase>

I realize that these aren't particularly secure parameters, but right now
I'm just trying to see what it will take to get this working.

Is there a plugin that will allow me to modify an existing jar?  I'm using
the dependency plugin to retrieve them from Maven, but once I have them
locally, I'm not sure what to use to update the MANIFEST.  Is this
something the assembly plugin can do easily?  I've looked at the assmbly
descriptor reference, but don't see where/how it can be leveraged for this.

Thanks,

Eric
Reply | Threaded
Open this post in threaded view
|

Re: Is there a plugin that allows me to modify existing jar manifest?

mgainty


________________________________
From: Eric B <[hidden email]>
Sent: Monday, November 13, 2017 5:51 PM
To: Maven Users List
Subject: Is there a plugin that allows me to modify existing jar manifest?

I'm looking to modify an existing third-party JAR's Manifest file in my
maven build.  Specifically, I have an Applet which has a dependency on
these third party jars, and need to add some entries/permissions to the
Manifest before I sign them for my Applet to use.

I'm looking to add the following:

                           <Permissions>all-permissions</Permissions>
                            <Codebase>*</Codebase>

<Application-Library-Allowable-Codebase>*</Application-Library-Allowable-Codebase>
                            <Trusted-Library>true</Trusted-Library>
                            <Application-Name>MyApp</Application-Name>

<Caller-Allowable-Codebase>*</Caller-Allowable-Codebase>

MG>Eric...did you try <archive> configuration parameter of maven-jar-plugin ?
https://maven.apache.org/plugins/maven-jar-plugin/examples/manifest-customization.html
Apache Maven JAR Plugin – Manifest customization<https://maven.apache.org/plugins/maven-jar-plugin/examples/manifest-customization.html>
maven.apache.org
The default contents of the manifest is described in the documentation for Maven Archiver. Starting with version 2.1, the maven-jar-plugin uses Maven Archiver 3.1.1 ...

MG>https://maven.apache.org/shared/maven-archiver/index.html
Apache Maven Archiver – Reference<https://maven.apache.org/shared/maven-archiver/index.html>
maven.apache.org
Apache Maven Archiver. The Maven Archiver is mainly used by plugins to handle packaging. The version numbers referenced in the Since column on this page are the ...




I realize that these aren't particularly secure parameters, but right now
I'm just trying to see what it will take to get this working.

Is there a plugin that will allow me to modify an existing jar?  I'm using
the dependency plugin to retrieve them from Maven, but once I have them
locally, I'm not sure what to use to update the MANIFEST.  Is this
something the assembly plugin can do easily?  I've looked at the assmbly
descriptor reference, but don't see where/how it can be leveraged for this.

Thanks,

Eric
Reply | Threaded
Open this post in threaded view
|

Re: Is there a plugin that allows me to modify existing jar manifest?

Eric B
Martin,

Thanks, but the jar-plugin only allows to build a jar from the current
project (and set appropriate Manifest entries).  I'm looking to modify an
existing jar.  I could use the dependency plugin to retrieve the jar, and
unpack it, then point the jar-plugin to the unpacked dependency and have it
repkg the dependency from the unpacked classes, but was hoping for
something a little less manual.  For multiple dependencies, I would need to
write a different execution config for the jar-plugin which becomes quite
bloatsome for my pom.  I was just hoping for a cleaner/easier approach.

I started looking at the shade plugin with a manifest transformer, but that
too becomes individual execution configs.

Thanks,

Eric

On Mon, Nov 13, 2017 at 8:03 PM, Martin Gainty <[hidden email]> wrote:

>
>
> ________________________________
> From: Eric B <[hidden email]>
> Sent: Monday, November 13, 2017 5:51 PM
> To: Maven Users List
> Subject: Is there a plugin that allows me to modify existing jar manifest?
>
> I'm looking to modify an existing third-party JAR's Manifest file in my
> maven build.  Specifically, I have an Applet which has a dependency on
> these third party jars, and need to add some entries/permissions to the
> Manifest before I sign them for my Applet to use.
>
> I'm looking to add the following:
>
>                            <Permissions>all-permissions</Permissions>
>                             <Codebase>*</Codebase>
>
> <Application-Library-Allowable-Codebase>*</Application-
> Library-Allowable-Codebase>
>                             <Trusted-Library>true</Trusted-Library>
>                             <Application-Name>MyApp</Application-Name>
>
> <Caller-Allowable-Codebase>*</Caller-Allowable-Codebase>
>
> MG>Eric...did you try <archive> configuration parameter of
> maven-jar-plugin ?
> https://maven.apache.org/plugins/maven-jar-plugin/examples/
> manifest-customization.html
> Apache Maven JAR Plugin – Manifest customization<https://maven.ap
> ache.org/plugins/maven-jar-plugin/examples/manifest-customization.html>
> maven.apache.org
> The default contents of the manifest is described in the documentation for
> Maven Archiver. Starting with version 2.1, the maven-jar-plugin uses Maven
> Archiver 3.1.1 ...
>
> MG>https://maven.apache.org/shared/maven-archiver/index.html
> Apache Maven Archiver – Reference<https://maven.apache
> .org/shared/maven-archiver/index.html>
> maven.apache.org
> Apache Maven Archiver. The Maven Archiver is mainly used by plugins to
> handle packaging. The version numbers referenced in the Since column on
> this page are the ...
>
>
>
>
> I realize that these aren't particularly secure parameters, but right now
> I'm just trying to see what it will take to get this working.
>
> Is there a plugin that will allow me to modify an existing jar?  I'm using
> the dependency plugin to retrieve them from Maven, but once I have them
> locally, I'm not sure what to use to update the MANIFEST.  Is this
> something the assembly plugin can do easily?  I've looked at the assmbly
> descriptor reference, but don't see where/how it can be leveraged for this.
>
> Thanks,
>
> Eric
>
Reply | Threaded
Open this post in threaded view
|

Re: Is there a plugin that allows me to modify existing jar manifest?

Maxim Solodovnik
Hello Eric,

we are using assembly plugin to achieve this:
https://github.com/apache/openmeetings/blob/master/openmeetings-screenshare/pom.xml#L158

On Tue, Nov 14, 2017 at 8:53 AM, Eric B <[hidden email]> wrote:

> Martin,
>
> Thanks, but the jar-plugin only allows to build a jar from the current
> project (and set appropriate Manifest entries).  I'm looking to modify an
> existing jar.  I could use the dependency plugin to retrieve the jar, and
> unpack it, then point the jar-plugin to the unpacked dependency and have it
> repkg the dependency from the unpacked classes, but was hoping for
> something a little less manual.  For multiple dependencies, I would need to
> write a different execution config for the jar-plugin which becomes quite
> bloatsome for my pom.  I was just hoping for a cleaner/easier approach.
>
> I started looking at the shade plugin with a manifest transformer, but that
> too becomes individual execution configs.
>
> Thanks,
>
> Eric
>
> On Mon, Nov 13, 2017 at 8:03 PM, Martin Gainty <[hidden email]>
> wrote:
>
> >
> >
> > ________________________________
> > From: Eric B <[hidden email]>
> > Sent: Monday, November 13, 2017 5:51 PM
> > To: Maven Users List
> > Subject: Is there a plugin that allows me to modify existing jar
> manifest?
> >
> > I'm looking to modify an existing third-party JAR's Manifest file in my
> > maven build.  Specifically, I have an Applet which has a dependency on
> > these third party jars, and need to add some entries/permissions to the
> > Manifest before I sign them for my Applet to use.
> >
> > I'm looking to add the following:
> >
> >                            <Permissions>all-permissions</Permissions>
> >                             <Codebase>*</Codebase>
> >
> > <Application-Library-Allowable-Codebase>*</Application-
> > Library-Allowable-Codebase>
> >                             <Trusted-Library>true</Trusted-Library>
> >                             <Application-Name>MyApp</Application-Name>
> >
> > <Caller-Allowable-Codebase>*</Caller-Allowable-Codebase>
> >
> > MG>Eric...did you try <archive> configuration parameter of
> > maven-jar-plugin ?
> > https://maven.apache.org/plugins/maven-jar-plugin/examples/
> > manifest-customization.html
> > Apache Maven JAR Plugin – Manifest customization<https://maven.ap
> > ache.org/plugins/maven-jar-plugin/examples/manifest-customization.html>
> > maven.apache.org
> > The default contents of the manifest is described in the documentation
> for
> > Maven Archiver. Starting with version 2.1, the maven-jar-plugin uses
> Maven
> > Archiver 3.1.1 ...
> >
> > MG>https://maven.apache.org/shared/maven-archiver/index.html
> > Apache Maven Archiver – Reference<https://maven.apache
> > .org/shared/maven-archiver/index.html>
> > maven.apache.org
> > Apache Maven Archiver. The Maven Archiver is mainly used by plugins to
> > handle packaging. The version numbers referenced in the Since column on
> > this page are the ...
> >
> >
> >
> >
> > I realize that these aren't particularly secure parameters, but right now
> > I'm just trying to see what it will take to get this working.
> >
> > Is there a plugin that will allow me to modify an existing jar?  I'm
> using
> > the dependency plugin to retrieve them from Maven, but once I have them
> > locally, I'm not sure what to use to update the MANIFEST.  Is this
> > something the assembly plugin can do easily?  I've looked at the assmbly
> > descriptor reference, but don't see where/how it can be leveraged for
> this.
> >
> > Thanks,
> >
> > Eric
> >
>



--
WBR
Maxim aka solomax
Reply | Threaded
Open this post in threaded view
|

Re: Is there a plugin that allows me to modify existing jar manifest?

Eric B
Thanks Maxim.  Will take a look at how you are using the assembly.xml to
accomplish that.

Much appreciated.

Eric

On Nov 13, 2017 10:03 PM, "Maxim Solodovnik" <[hidden email]> wrote:

> Hello Eric,
>
> we are using assembly plugin to achieve this:
> https://github.com/apache/openmeetings/blob/master/
> openmeetings-screenshare/pom.xml#L158
>
> On Tue, Nov 14, 2017 at 8:53 AM, Eric B <[hidden email]> wrote:
>
> > Martin,
> >
> > Thanks, but the jar-plugin only allows to build a jar from the current
> > project (and set appropriate Manifest entries).  I'm looking to modify an
> > existing jar.  I could use the dependency plugin to retrieve the jar, and
> > unpack it, then point the jar-plugin to the unpacked dependency and have
> it
> > repkg the dependency from the unpacked classes, but was hoping for
> > something a little less manual.  For multiple dependencies, I would need
> to
> > write a different execution config for the jar-plugin which becomes quite
> > bloatsome for my pom.  I was just hoping for a cleaner/easier approach.
> >
> > I started looking at the shade plugin with a manifest transformer, but
> that
> > too becomes individual execution configs.
> >
> > Thanks,
> >
> > Eric
> >
> > On Mon, Nov 13, 2017 at 8:03 PM, Martin Gainty <[hidden email]>
> > wrote:
> >
> > >
> > >
> > > ________________________________
> > > From: Eric B <[hidden email]>
> > > Sent: Monday, November 13, 2017 5:51 PM
> > > To: Maven Users List
> > > Subject: Is there a plugin that allows me to modify existing jar
> > manifest?
> > >
> > > I'm looking to modify an existing third-party JAR's Manifest file in my
> > > maven build.  Specifically, I have an Applet which has a dependency on
> > > these third party jars, and need to add some entries/permissions to the
> > > Manifest before I sign them for my Applet to use.
> > >
> > > I'm looking to add the following:
> > >
> > >                            <Permissions>all-permissions</Permissions>
> > >                             <Codebase>*</Codebase>
> > >
> > > <Application-Library-Allowable-Codebase>*</Application-
> > > Library-Allowable-Codebase>
> > >                             <Trusted-Library>true</Trusted-Library>
> > >                             <Application-Name>MyApp</Application-Name>
> > >
> > > <Caller-Allowable-Codebase>*</Caller-Allowable-Codebase>
> > >
> > > MG>Eric...did you try <archive> configuration parameter of
> > > maven-jar-plugin ?
> > > https://maven.apache.org/plugins/maven-jar-plugin/examples/
> > > manifest-customization.html
> > > Apache Maven JAR Plugin – Manifest customization<https://maven.ap
> > > ache.org/plugins/maven-jar-plugin/examples/manifest-customization.html
> >
> > > maven.apache.org
> > > The default contents of the manifest is described in the documentation
> > for
> > > Maven Archiver. Starting with version 2.1, the maven-jar-plugin uses
> > Maven
> > > Archiver 3.1.1 ...
> > >
> > > MG>https://maven.apache.org/shared/maven-archiver/index.html
> > > Apache Maven Archiver – Reference<https://maven.apache
> > > .org/shared/maven-archiver/index.html>
> > > maven.apache.org
> > > Apache Maven Archiver. The Maven Archiver is mainly used by plugins to
> > > handle packaging. The version numbers referenced in the Since column on
> > > this page are the ...
> > >
> > >
> > >
> > >
> > > I realize that these aren't particularly secure parameters, but right
> now
> > > I'm just trying to see what it will take to get this working.
> > >
> > > Is there a plugin that will allow me to modify an existing jar?  I'm
> > using
> > > the dependency plugin to retrieve them from Maven, but once I have them
> > > locally, I'm not sure what to use to update the MANIFEST.  Is this
> > > something the assembly plugin can do easily?  I've looked at the
> assmbly
> > > descriptor reference, but don't see where/how it can be leveraged for
> > this.
> > >
> > > Thanks,
> > >
> > > Eric
> > >
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>
Reply | Threaded
Open this post in threaded view
|

Re: Is there a plugin that allows me to modify existing jar manifest?

mgainty
In reply to this post by Eric B




________________________________
From: Eric B <[hidden email]>
Sent: Monday, November 13, 2017 8:53 PM
To: Maven Users List
Subject: Re: Is there a plugin that allows me to modify existing jar manifest?

Martin,

Thanks, but the jar-plugin only allows to build a jar from the current
project (and set appropriate Manifest entries).  I'm looking to modify an
existing jar.  I could use the dependency plugin to retrieve the jar, and
unpack it, then point the jar-plugin to the unpacked dependency and have it
repkg the dependency from the unpacked classes, but was hoping for
something a little less manual.  For multiple dependencies, I would need to
write a different execution config for the jar-plugin which becomes quite
bloatsome for my pom.  I was just hoping for a cleaner/easier approach.

I started looking at the shade plugin with a manifest transformer, but that
too becomes individual execution configs.

MG>in JIRA for maven-execution-plugin suggest <execution> <id> as a parameter

MG>the other way is to have some sort of XSLT transform from pom.xml which will sub in new id to transformed_pom.xml

sed -i "s/$id/$new_id/" pom.xml

<https://wiki.jenkins.io/display/JENKINS/Parameterized+Build>
Parameterized Build - Jenkins - Jenkins Wiki<https://wiki.jenkins.io/display/JENKINS/Parameterized+Build>
wiki.jenkins.io
Sometimes, it is useful/necessary to have your builds take several "parameters." Consider the following use case: You set up a test job on Jenkins, and it accepts a ...



Thanks,

Eric

On Mon, Nov 13, 2017 at 8:03 PM, Martin Gainty <[hidden email]> wrote:

>
>
> ________________________________
> From: Eric B <[hidden email]>
> Sent: Monday, November 13, 2017 5:51 PM
> To: Maven Users List
> Subject: Is there a plugin that allows me to modify existing jar manifest?
>
> I'm looking to modify an existing third-party JAR's Manifest file in my
> maven build.  Specifically, I have an Applet which has a dependency on
> these third party jars, and need to add some entries/permissions to the
> Manifest before I sign them for my Applet to use.
>
> I'm looking to add the following:
>
>                            <Permissions>all-permissions</Permissions>
>                             <Codebase>*</Codebase>
>
> <Application-Library-Allowable-Codebase>*</Application-
> Library-Allowable-Codebase>
>                             <Trusted-Library>true</Trusted-Library>
>                             <Application-Name>MyApp</Application-Name>
>
> <Caller-Allowable-Codebase>*</Caller-Allowable-Codebase>
>
> MG>Eric...did you try <archive> configuration parameter of
> maven-jar-plugin ?
> https://maven.apache.org/plugins/maven-jar-plugin/examples/
> manifest-customization.html
> Apache Maven JAR Plugin – Manifest customization<https://maven.ap
> ache.org/plugins/maven-jar-plugin/examples/manifest-customization.html>
> maven.apache.org
> The default contents of the manifest is described in the documentation for
> Maven Archiver. Starting with version 2.1, the maven-jar-plugin uses Maven
> Archiver 3.1.1 ...
>
> MG>https://maven.apache.org/shared/maven-archiver/index.html
> Apache Maven Archiver – Reference<https://maven.apache
> .org/shared/maven-archiver/index.html>
> maven.apache.org
> Apache Maven Archiver. The Maven Archiver is mainly used by plugins to
> handle packaging. The version numbers referenced in the Since column on
> this page are the ...
>
>
>
>
> I realize that these aren't particularly secure parameters, but right now
> I'm just trying to see what it will take to get this working.
>
> Is there a plugin that will allow me to modify an existing jar?  I'm using
> the dependency plugin to retrieve them from Maven, but once I have them
> locally, I'm not sure what to use to update the MANIFEST.  Is this
> something the assembly plugin can do easily?  I've looked at the assmbly
> descriptor reference, but don't see where/how it can be leveraged for this.
>
> Thanks,
>
> Eric
>