Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-3880

package phase devided into more specific phases

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.0.9
    • None
    • Plugins and Lifecycle
    • None

    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="${staging.dir}.${project.packaging}" encoding="UTF8" whenempty="create">
      <fileset dir="${staging.dir}"/>
      </zip>

      Attachments

        Issue Links

          Activity

            People

              brett Brett Porter
              aka3 Anders Kristian Andersen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: