This is different than the way you want to do it, but generally I use
antrun invocations to build my secondary artifacts (also influenced by
the fact we're migrating from Ant, anyway, so it's easy to copy over).
For you, it might look something like:

      <plugin>      
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>gen-obfuscated-jar</id>
            <phase>package</phase>
            <configuration>
              <tasks>
                <jar basedir="${basedir}/target/obfuscated-classes/"
destfile="${project.build.directory}/${project.name}-${project.version}-
obfuscated.jar" />
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution> 
        </executions>
      </plugin>

The only difference I've noticed is that the jar plugin will by default
add Maven descriptor files to the jar; the ant invocation won't.

Chris

> -----Original Message-----
> From: Dave Comeau [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, 10 August, 2006 22:17
> To: Maven list (E-mail)
> Subject: Want to create a second jar for obfuscated classes
> 
> 
> This is a noob question...
> 
> In my project I need to obfuscate my classes, and produce two 
> jars:  one with the unobfuscated code, one with the obfuscated code.
> 
> The obfuscation is Ant task attached to the process-classes 
> phase, which outputs the obfuscated classes in a folder 
> called ${basedir}/target/obfuscated-classes/
> 
> My hope is that I can just use Maven's jar plugin to create 
> the second jar with the same resources/content/format as the 
> first jar, except it's outputDirectory (where it finds the 
> classes to put in the jar) is ${basedir}/target/obfuscated-classes/
> 
> So I tried adding this to my pom:
> 
> <!-- Jar plugin, build a jar from the obfuscated classes -->
> 
> <plugin>
> 
>    <groupId>org.apache.maven.plugins</groupId>
> 
>    <artifactId>maven-jar-plugin</artifactId>
> 
>    <executions>
> 
>      <execution>
> 
>        <id>obfuscated-jar</id>
> 
>        <phase>package</phase>
> 
>        <goals>
> 
>          <goal>jar</goal>
> 
>        </goals>
> 
>        <configuration>
> 
>               <jarName>obfuscated-jar</jarName>               
>                  
>  
> <outputDirectory>${basedir}/target/obfuscation/classes</output
> Directory>
>        </configuration>
> 
>      </execution>
> 
>    </executions>
> 
>  </plugin>
> 
> 
> But I get an error that outputDirectory is read only.  If I 
> remove the outputDirectory, I do get two jars, but their 
> identical.  Is it possible to do what I want to do?
> 
> Thank you ,
> Dave
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to