package phase devided into more specific phases
-----------------------------------------------

                 Key: MNG-3880
                 URL: http://jira.codehaus.org/browse/MNG-3880
             Project: Maven 2
          Issue Type: Improvement
          Components: Plugins and Lifecycle
    Affects Versions: 2.0.9
            Reporter: Anders Kr. Andersen


Currently the command mvn package will produce a zipped result file like xx.war 
or xxx.jar

So I belive it must always be...

I suggest that the phase is devided into multiple pre phases like:

package-copy       --> copies files to target/xxx-war (the prezipped directory 
structure)
package-manifest   --> generates the manifest to be packed into the zipped 
result
package-maven   --> generates the maven META-INF/maven files
package-compress --> zips the  target/xxx-war into the file target/xxx-war.war

The reasoning for these suggestions is that I had a situation where I had to 
add more files into the unpacked result.
This ended up more jobbi than I had thought because I had to manage the 
manifest, maven and compress as well.

Best regards
/Anders

PS: My sample is a Weblogic Integration Problem with task  
weblogic.ant.taskdefs.build.AnnotationManifestTask
The task will go through all classes and jars in the result and make a kind of 
index and place the index into META-INF.

My code got ugly....
I had to run the task yes, ofcause..
But I had to do much more than I hoped.
1) MANIFEST.MF  (maven generates it under the final ZIP process) I had to steal 
it from mavens ZIP
2) META-INF/maven/.... (Maven also generates it under the final ZIP process). I 
had to steal this as well
3) the package phase will do the compress as well. I had to zip again !!! 
(Maybe I could just update existing zip?, but i did not choose that)

If I had multiple steps in the package phase I could have made this 
"customer-plugin" easier...


Here is the ugly code


        <build-manifests moduleDir="${staging.dir}"
                     searchClasspathRef="annotation.manifest.search.path"
                     classpathRef="annotation.manifest.class.path"
                     verbose="false"
                     version=""
                     stagingDir="${project.build.directory}/manifest-work"/>

        
        <unzip src="${staging.dir}.${project.packaging}"
            dest="${staging.dir}">
            <patternset>
            <include name="META-INF/**/*.*"/>
            </patternset>
        </unzip>

        <delete dir="${staging.dir}/WEB-INF/classes/META-INF/" />
        <delete file="${staging.dir}.${project.packaging}" />
        <zip destfile="${staging.dir}.${project.packaging}" encoding="UTF8" 
whenempty="create">
        <fileset dir="${staging.dir}"/>
        </zip>






 





-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to