Maven Jar Signer Plugin
  1. Maven Jar Signer Plugin
  2. MJARSIGNER-19

Make mojo code reusable from another mojo + customize the working directory.

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.2
    • Labels:
      None
    • Patch Submitted:
      Yes
    • Number of attachments :
      2

      Description

      In the webstart-maven-plugin We used the old jarsigner mojo (from the jar plugin).

      We'd like to use now this plugin as the mojo from the jar plugin is deprecated for this one (see MWEBSTART-149)

      Moreover, we want to use yet another working directory and at the moment in the mojo this is hardcoed to project.getBasedir().

      Here is a patch which fix our needs.

      Hope this patch will be apply soon, I would really like to use your mojo

      Thanks for your work.

      1. create-jarsigner-sharedcomponent.diff
        61 kB
        Tony Chemit
      2. MJARSIGNER-19.patch
        7 kB
        Tony Chemit

        Issue Links

          Activity

          Hide
          Benjamin Bentmann added a comment -

          The proper way to reuse this functionality is to extract the desired code into a shared component which both mojos than use. Subclassing mojos is an anti-pattern.

          Show
          Benjamin Bentmann added a comment - The proper way to reuse this functionality is to extract the desired code into a shared component which both mojos than use. Subclassing mojos is an anti-pattern.
          Hide
          Tony Chemit added a comment -

          Benjamin, do you have an example of a such shared component (using a system command-line)?

          I could prepare the code then give you the patch to create the shared component. I really like to move forward on the webstart plugin, so I am ready to help activly.

          Could you also briefly explain me why subclassing mojos is bad?

          Thanks

          Show
          Tony Chemit added a comment - Benjamin, do you have an example of a such shared component (using a system command-line)? I could prepare the code then give you the patch to create the shared component. I really like to move forward on the webstart plugin, so I am ready to help activly. Could you also briefly explain me why subclassing mojos is bad? Thanks
          Hide
          Benjamin Bentmann added a comment - - edited

          Look at the maven-filtering or maven-invoker components as examples of shared functionality.

          As for the subclassing approach, see http://en.wikipedia.org/wiki/Composition_over_inheritance as a general hint. Maintenance of the JAR Signer Plugin should be possible without having to think about plugin A, B or whoever feels like reusing JAR signing. Maven plugins are not libraries with an API contract, their only purpose is to be invoked by Maven to handle a given use case during a user's build. For instance, your patch adds a new parameter to configure the working directory to the plugin which seems to have no real value in the context of the JAR signer plugin, i.e. pollutes the JAR signer plugin's user interface with external requirements.

          Show
          Benjamin Bentmann added a comment - - edited Look at the maven-filtering or maven-invoker components as examples of shared functionality. As for the subclassing approach, see http://en.wikipedia.org/wiki/Composition_over_inheritance as a general hint. Maintenance of the JAR Signer Plugin should be possible without having to think about plugin A, B or whoever feels like reusing JAR signing. Maven plugins are not libraries with an API contract, their only purpose is to be invoked by Maven to handle a given use case during a user's build. For instance, your patch adds a new parameter to configure the working directory to the plugin which seems to have no real value in the context of the JAR signer plugin, i.e. pollutes the JAR signer plugin's user interface with external requirements.
          Hide
          Tony Chemit added a comment -

          Ok Benjamin,

          I just submitted a new patch with the shared component.

          Could you have a look at it, everythin works fine except for the log I think since the Commandline object should no more be exposed into the mojo ?
          I used a lot the design of the share invoker component.
          If everything is ok, do you want me to do anything else (create new issues for example ?).

          Hopes it helps.

          Show
          Tony Chemit added a comment - Ok Benjamin, I just submitted a new patch with the shared component. Could you have a look at it, everythin works fine except for the log I think since the Commandline object should no more be exposed into the mojo ? I used a lot the design of the share invoker component. If everything is ok, do you want me to do anything else (create new issues for example ?). Hopes it helps.
          Hide
          Benjamin Bentmann added a comment -

          That's heading in the right direction. Coupling the JAR signer component API to plexus-utils might not be ideal but that's something the eventual committer can decide. At any rate, the patch is a significant change and unless you have already a CLA with Apache on file, you likely want to read http://www.apache.org/licenses/#clas.

          Show
          Benjamin Bentmann added a comment - That's heading in the right direction. Coupling the JAR signer component API to plexus-utils might not be ideal but that's something the eventual committer can decide. At any rate, the patch is a significant change and unless you have already a CLA with Apache on file, you likely want to read http://www.apache.org/licenses/#clas .
          Hide
          Tony Chemit added a comment -

          CLA registred.

          Show
          Tony Chemit added a comment - CLA registred.
          Hide
          Christian Schulte added a comment -

          Just a quick note regarding MJARSIGNER-9. Will it be possible to extend the shared component to support toolchains ? Haven't looked at it that closely.

          Show
          Christian Schulte added a comment - Just a quick note regarding MJARSIGNER-9 . Will it be possible to extend the shared component to support toolchains ? Haven't looked at it that closely.
          Hide
          Christian Schulte added a comment -

          Due to MJARSIGNER-18, class JarSignerUtil may need to provide an 'isSigned( java.io.File jar )' method which scans an archive for any signature files to exist.

          Show
          Christian Schulte added a comment - Due to MJARSIGNER-18 , class JarSignerUtil may need to provide an 'isSigned( java.io.File jar )' method which scans an archive for any signature files to exist.
          Hide
          Christian Schulte added a comment -

          http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6870812
          http://hg.openjdk.java.net/jdk7/tl/jdk/rev/0d7c64c023c6

          Method 'JarSignerUtil.isSignatureFile( String entryName )' may need to also account for files ending in '.EC'.

          Show
          Christian Schulte added a comment - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6870812 http://hg.openjdk.java.net/jdk7/tl/jdk/rev/0d7c64c023c6 Method 'JarSignerUtil.isSignatureFile( String entryName )' may need to also account for files ending in '.EC'.
          Hide
          Olivier Lamy added a comment -

          code imported in r1190297.
          I leave it open as I prefer to have a real external component located in : http://svn.apache.org/repos/asf/maven/shared/trunk/ maven-jarsigner in order to have release cycle different from the plugin.

          Show
          Olivier Lamy added a comment - code imported in r1190297. I leave it open as I prefer to have a real external component located in : http://svn.apache.org/repos/asf/maven/shared/trunk/ maven-jarsigner in order to have release cycle different from the plugin.
          Hide
          Olivier Lamy added a comment -

          so all done.
          Have fun

          Show
          Olivier Lamy added a comment - so all done. Have fun
          Hide
          Tony Chemit added a comment -

          Olivier is the Guy Thanks.

          Show
          Tony Chemit added a comment - Olivier is the Guy Thanks.

            People

            • Assignee:
              Olivier Lamy
              Reporter:
              Tony Chemit
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: