You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Anders Kr. Andersen (JIRA)" <ji...@codehaus.org> on 2008/12/01 11:51:19 UTC

[jira] Created: (MNG-3880) package phase devided into more specific phases

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

        

[jira] Commented: (MNG-3880) package phase devided into more specific phases

Posted by "Paul Benedict (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-3880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=156273#action_156273 ] 

Paul Benedict commented on MNG-3880:
------------------------------------

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?

> 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

        

[jira] Closed: (MNG-3880) package phase devided into more specific phases

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-3880?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Porter closed MNG-3880.
-----------------------------

      Assignee: Brett Porter
    Resolution: Duplicate

we've added a "prepare-package" phase. The war plugin will still need to be adjusted over time. I believe further splitting of the phase would be overkill.

> 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
>            Assignee: Brett Porter
>
> 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

        

[jira] Commented: (MNG-3880) package phase devided into more specific phases

Posted by "Anders Kr. Andersen (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-3880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=156353#action_156353 ] 

Anders Kr. Andersen commented on MNG-3880:
------------------------------------------

In this case my problem is that war:war (the package phase) is doing too much in one "job"
The war:war will 1) copy the sources, classes, jars and resources into the pre-zipped directory, 2) generate manifest 3) zip the directory.

The Weblogic build-manifests needs the final classes and jars for searching and make the "index" file.

That is why I want to be able to add functionality to war:war before the zipping and manifest making takes place.
I want to add my "job" in the mittle of this process, currently after the "copy" but before generating manifest.

So I'm not sure that a "pre"/"post" chain helps here. Because the problem is that war:war does too many things. 

I feel good about adding more phases because it makes it more precise what Maven is doing. Once a man told me that "being precise" is a core quality in software making :-)
 




> 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