You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Karsten Silz <ka...@me.com> on 2011/01/29 01:23:38 UTC

How to migrate Ant obfuscation build to Maven?

Hi,

Part of my job is to maintain an Ant build to obfuscate a web app. This
happens in four steps:
- Ant builds the WAR file on PC
- WAR file gets uploaded to a server where it is obfuscated (which - due to
class and method renaming - also changes configuration files and accesses
the libraries)
- obfuscated WAR file and obfuscation log (needed for decoding stack traces)
are added to an internal build application on that server
- obfuscated WAR file and obfuscation log are downloaded again to PC,
obfuscation log is added to version management (just to be on the safe side)

The web app was migrated to Maven more than a year ago, and we've just
started using the release plugin (we run our own internal Nexus Maven
repository).  But now we want to change the obfuscation build. 
Additionally, we want to build a ZIP file as the build result that includes
the WAR file, along with database scripts, release notes and such.  Now I
have these questions:

- The Maven Assembly plug-in seems to be the right choice for changing what
goes into the WAR file (which we don't want to change), but how can I build
the above described ZIP file instead?

- How does the obfuscation fit into the Maven lifecylce, since it creates
the final artifact, so to speak, but also requires the WAR file to be built,
which itself already concludes the packaging phase?  Would I need to "abuse"
a later phase (such as "verify") to do the obfuscation?

- Sine the AntRun plugin got deprecated with Maven 3, is our own custom
plugin the best way to trigger the obfuscation process and download its
results?

- Since the obfuscation should be part of a Maven release (using the release
plugin), the release plugin assumes that there is no locally changed file,
compared against the source code repository.  How could we then update the
obfuscation log in the our source code management system as part of the
Maven release, if at all?

- I read somewhere that deploying a custom ZIP file like the one described
aboveto our own Maven repository is frowned upon because the Maven
repository doesn't know what to do with such a file, unlike a JAR file, for
instance.  If that is true, what would we then deploy to our internal Maven
repository - just the WAR file?

Thank you for your help!

Karsten Silz
-- 
View this message in context: http://maven.40175.n5.nabble.com/How-to-migrate-Ant-obfuscation-build-to-Maven-tp3362293p3362293.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: How to migrate Ant obfuscation build to Maven?

Posted by Manfred Moser <ma...@mosabuam.com>.
I can only second that idea. I am using it for Android applications built
with Maven and blogged a few tips for setting it up recently. That might
help for normal stuff as well (e.g. keeping the map file if you
obfuscate..)

See more

http://www.simpligility.com/2010/12/proguard-for-android-with-maven-without-shooting-yourself-in-the-foot/

http://www.simpligility.com/2010/12/hints-for-using-proguard-on-your-android-app/

manfred




> http://pyx4me.com/pyx4me-maven-plugins/proguard-maven-plugin/.
> Obfuscate the jars that go into the war or obfuscate the classes
> directly before they are packaged into the war. The plugin can do
> both. Deploy the zip to your repository as well as the war.
>
> Kalle
>
>
> On Fri, Jan 28, 2011 at 4:23 PM, Karsten Silz <ka...@me.com> wrote:
>>
>> Hi,
>>
>> Part of my job is to maintain an Ant build to obfuscate a web app. This
>> happens in four steps:
>> - Ant builds the WAR file on PC
>> - WAR file gets uploaded to a server where it is obfuscated (which - due
>> to
>> class and method renaming - also changes configuration files and
>> accesses
>> the libraries)
>> - obfuscated WAR file and obfuscation log (needed for decoding stack
>> traces)
>> are added to an internal build application on that server
>> - obfuscated WAR file and obfuscation log are downloaded again to PC,
>> obfuscation log is added to version management (just to be on the safe
>> side)
>>
>> The web app was migrated to Maven more than a year ago, and we've just
>> started using the release plugin (we run our own internal Nexus Maven
>> repository).  But now we want to change the obfuscation build.
>> Additionally, we want to build a ZIP file as the build result that
>> includes
>> the WAR file, along with database scripts, release notes and such.  Now
>> I
>> have these questions:
>>
>> - The Maven Assembly plug-in seems to be the right choice for changing
>> what
>> goes into the WAR file (which we don't want to change), but how can I
>> build
>> the above described ZIP file instead?
>>
>> - How does the obfuscation fit into the Maven lifecylce, since it
>> creates
>> the final artifact, so to speak, but also requires the WAR file to be
>> built,
>> which itself already concludes the packaging phase?  Would I need to
>> "abuse"
>> a later phase (such as "verify") to do the obfuscation?
>>
>> - Sine the AntRun plugin got deprecated with Maven 3, is our own custom
>> plugin the best way to trigger the obfuscation process and download its
>> results?
>>
>> - Since the obfuscation should be part of a Maven release (using the
>> release
>> plugin), the release plugin assumes that there is no locally changed
>> file,
>> compared against the source code repository.  How could we then update
>> the
>> obfuscation log in the our source code management system as part of the
>> Maven release, if at all?
>>
>> - I read somewhere that deploying a custom ZIP file like the one
>> described
>> aboveto our own Maven repository is frowned upon because the Maven
>> repository doesn't know what to do with such a file, unlike a JAR file,
>> for
>> instance.  If that is true, what would we then deploy to our internal
>> Maven
>> repository - just the WAR file?
>>
>> Thank you for your help!
>>
>> Karsten Silz
>> --
>> View this message in context:
>> http://maven.40175.n5.nabble.com/How-to-migrate-Ant-obfuscation-build-to-Maven-tp3362293p3362293.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: How to migrate Ant obfuscation build to Maven?

Posted by Karsten Silz <ka...@me.com>.

Karsten Silz wrote:
> 
> So I assume that right way for Maven obfuscation is to do the obfuscation
> in the "prepare-package" state through a plugin (e.g., mine in this case),
> build the ZIP file there and deploy it to our repository. Correct?
> 

Turns out we can't do this - we use MyEclipse where the Maven "package" is
the only way to update the "WEB-INF/lib" directory with the latest JARS
(that directory is used by the Tomcat integration).
-- 
View this message in context: http://maven.40175.n5.nabble.com/How-to-migrate-Ant-obfuscation-build-to-Maven-tp3362293p3366939.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: How to migrate Ant obfuscation build to Maven?

Posted by Karsten Silz <ka...@me.com>.
We use another obfuscation software - Zelix Klassmaster
(http://www.zelix.com/klassmaster).  They only have an Ant task, no Maven
plugin.  But I could write my own plugin that calls the Ant task or call the
obfuscator directly.

So I assume that right way for Maven obfuscation is to do the obfuscation in
the "prepare-package" state through a plugin (e.g., mine in this case),
build the ZIP file there and deploy it to our repository. Correct?
-- 
View this message in context: http://maven.40175.n5.nabble.com/How-to-migrate-Ant-obfuscation-build-to-Maven-tp3362293p3363421.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: How to migrate Ant obfuscation build to Maven?

Posted by Kalle Korhonen <ka...@gmail.com>.
http://pyx4me.com/pyx4me-maven-plugins/proguard-maven-plugin/.
Obfuscate the jars that go into the war or obfuscate the classes
directly before they are packaged into the war. The plugin can do
both. Deploy the zip to your repository as well as the war.

Kalle


On Fri, Jan 28, 2011 at 4:23 PM, Karsten Silz <ka...@me.com> wrote:
>
> Hi,
>
> Part of my job is to maintain an Ant build to obfuscate a web app. This
> happens in four steps:
> - Ant builds the WAR file on PC
> - WAR file gets uploaded to a server where it is obfuscated (which - due to
> class and method renaming - also changes configuration files and accesses
> the libraries)
> - obfuscated WAR file and obfuscation log (needed for decoding stack traces)
> are added to an internal build application on that server
> - obfuscated WAR file and obfuscation log are downloaded again to PC,
> obfuscation log is added to version management (just to be on the safe side)
>
> The web app was migrated to Maven more than a year ago, and we've just
> started using the release plugin (we run our own internal Nexus Maven
> repository).  But now we want to change the obfuscation build.
> Additionally, we want to build a ZIP file as the build result that includes
> the WAR file, along with database scripts, release notes and such.  Now I
> have these questions:
>
> - The Maven Assembly plug-in seems to be the right choice for changing what
> goes into the WAR file (which we don't want to change), but how can I build
> the above described ZIP file instead?
>
> - How does the obfuscation fit into the Maven lifecylce, since it creates
> the final artifact, so to speak, but also requires the WAR file to be built,
> which itself already concludes the packaging phase?  Would I need to "abuse"
> a later phase (such as "verify") to do the obfuscation?
>
> - Sine the AntRun plugin got deprecated with Maven 3, is our own custom
> plugin the best way to trigger the obfuscation process and download its
> results?
>
> - Since the obfuscation should be part of a Maven release (using the release
> plugin), the release plugin assumes that there is no locally changed file,
> compared against the source code repository.  How could we then update the
> obfuscation log in the our source code management system as part of the
> Maven release, if at all?
>
> - I read somewhere that deploying a custom ZIP file like the one described
> aboveto our own Maven repository is frowned upon because the Maven
> repository doesn't know what to do with such a file, unlike a JAR file, for
> instance.  If that is true, what would we then deploy to our internal Maven
> repository - just the WAR file?
>
> Thank you for your help!
>
> Karsten Silz
> --
> View this message in context: http://maven.40175.n5.nabble.com/How-to-migrate-Ant-obfuscation-build-to-Maven-tp3362293p3362293.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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