Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 2.0.9
-
Fix Version/s: None
-
Component/s: Plugins and Lifecycle
-
Labels:None
-
Complexity:Intermediate
-
Number of attachments :
Description
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="$
<fileset dir="${staging.dir}
"/>
</zip>
Issue Links
- duplicates
-
MNG-2097
adding a phase called prepare-package
-
I don't think the solution is to have more phases. What about simply allowing a pre or post chain of behavior on each phase?