Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5206

axis2-aar-maven-plugin fails to build aar while using m2e in workspace resolution mode

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Reopened
    • Major
    • Resolution: Unresolved
    • 1.5.6, 1.6.1
    • None
    • Tools
    • None

    Description

      First time posting an issue request. Apologies if I'm doing it wrong...

      When building in Eclipse using m2e in workspace resolution mode, the axis2-aar-maven-plugin is not prepared for a "dependency" which isn't an assembly but is instead a folder containing the compiled classes from within the local workspace. I propose that if the incoming dependency happens to be a directory that it get packaged up and copied to the destination instead of blowing up with an exception.

      (there is no place to attach a patch, so I'll include a code snippet illustrating my idea)

      Modifying this function in AbstractAarMojo.java will give the intended result:

      private void copyFileIfModified(File source, File destination)
      throws IOException {
      // TO DO: Remove this method and use the method in WarFileUtils when Maven 2 changes
      // to plexus-utils 1.2.
      if (destination.lastModified() < source.lastModified()) {
      if (source.isDirectory()) {
      JarArchiver jarArchiver = new JarArchiver();
      try

      { jarArchiver.setDestFile( destination ); jarArchiver.addDirectory( source.getCanonicalFile() ); jarArchiver.createArchive(); }

      catch (ArchiverException e)

      { // wrap ArchiverException in IOException throw new IOException(e); }

      } else

      { FileUtils.copyFile(source.getCanonicalFile(), destination); // preserve timestamp destination.setLastModified(source.lastModified()); }

      }
      }

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--screenshot-1.jpg
          87 kB
          Chris Gamache
        2. AbstractAarMojo.java.patch
          2 kB
          Chris Gamache

        Activity

          People

            Unassigned Unassigned
            iamchris Chris Gamache
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: