Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-alpha-4, 2.0
    • Fix Version/s: 2.1
    • Component/s: Creator
    • Labels:
      None
    • Number of attachments :
      1

      Description

      archetype.xml currently provides no way of creating empty directories.

        Issue Links

          Activity

          Hide
          Greg Wittel added a comment - - edited

          ARCHETYPE-57 was never really resolved. As of alpha-4 and alpha-5 empty directories are not included in the archetype JAR files. There seem to be two issues:

          1) – Edit/clarification: Doesn't seem to be necessary.

          2) The archetype archiver/JAR goal does not include empty directories unless explicitly listed in the archetype-metadata.xml. You can't apply inclusion wildcards, etc. The JAR mojo should include an includeEmptyDirs option. Additionally, this will require code changes to: archetype-common/src/main/java/org/apache/maven/archetype/DefaultArchetype.java (maybe others as well?)
          In particular the archiveArchetype and zipper routines to include empty directories.

          e.g. in zipper()
          111 {
          112 File[] files = currentSourceDirectory.listFiles();
          113
          114 for ( int i = 0; i < files.length; i++ )
          115 {
          116 if ( files[i].isDirectory() )
          117 {
          118 zipper( zos, offset, files[i] );

          This area should have a check for if(includeEmptyDirs && files.length == 0)

          { ... add dir }
          Show
          Greg Wittel added a comment - - edited ARCHETYPE-57 was never really resolved. As of alpha-4 and alpha-5 empty directories are not included in the archetype JAR files. There seem to be two issues: 1) – Edit/clarification: Doesn't seem to be necessary. 2) The archetype archiver/JAR goal does not include empty directories unless explicitly listed in the archetype-metadata.xml. You can't apply inclusion wildcards, etc. The JAR mojo should include an includeEmptyDirs option. Additionally, this will require code changes to: archetype-common/src/main/java/org/apache/maven/archetype/DefaultArchetype.java (maybe others as well?) In particular the archiveArchetype and zipper routines to include empty directories. e.g. in zipper() 111 { 112 File[] files = currentSourceDirectory.listFiles(); 113 114 for ( int i = 0; i < files.length; i++ ) 115 { 116 if ( files [i] .isDirectory() ) 117 { 118 zipper( zos, offset, files [i] ); This area should have a check for if(includeEmptyDirs && files.length == 0) { ... add dir }
          Hide
          Herve Boutemy added a comment -

          archetype.xml is for Archetype 1.0.x: nothing will be fixed there

          archetype-metadata.xml is for Archetype 2.0.x: if you provide a test case that I can reproduce, I'll work on a fix

          Show
          Herve Boutemy added a comment - archetype.xml is for Archetype 1.0.x: nothing will be fixed there archetype-metadata.xml is for Archetype 2.0.x: if you provide a test case that I can reproduce, I'll work on a fix
          Hide
          Grégory Joseph added a comment -

          Herve, the attached zip file should show the issue. src/main/webapp is included in the generated artifact, as per the archetype-metadata.xml, but none of it's (empty) subdirectories is.

          Show
          Grégory Joseph added a comment - Herve, the attached zip file should show the issue. src/main/webapp is included in the generated artifact, as per the archetype-metadata.xml , but none of it's (empty) subdirectories is.
          Hide
          Herve Boutemy added a comment -

          first pass in r1159926
          this is actually limited to non-filtered filesets, I still need to investigate if it is reasonably extensible to filtered filesets (which actually creates an empty file instead of an empty directory)

          notice that you must configure includeEmptyDirs=true for maven-resources-plugin or the archetype jar won't contain the empty directory (then of course the project generated from the archatype can't contain it...)

          Show
          Herve Boutemy added a comment - first pass in r1159926 this is actually limited to non-filtered filesets, I still need to investigate if it is reasonably extensible to filtered filesets (which actually creates an empty file instead of an empty directory) notice that you must configure includeEmptyDirs=true for maven-resources-plugin or the archetype jar won't contain the empty directory (then of course the project generated from the archatype can't contain it...)
          Hide
          Herve Boutemy added a comment -

          filtered support added in r1159957

          IT support (comparison against reference) added in r1159975

          Show
          Herve Boutemy added a comment - filtered support added in r1159957 IT support (comparison against reference) added in r1159975

            People

            • Assignee:
              Herve Boutemy
              Reporter:
              Greg Wittel
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: