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

signing in multi-module project fails on windows

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.3
    • Labels:
      None
    • Environment:
      Windows XP, android sdk
    • Number of attachments :
      1

      Description

      I got multi-module (6 modules) android project with .pom file and "sign" profile defined. When I execute with 'sign' profile:

      • in Maven 3.0.1 - it signs 3 modules and fails. when I resume the execution (mv <goal> -rf) it signs another 3 modules and fails again. The reason for failing is: [INFO] jarsigner: attempt to rename xxx.jar to xxx.jar.orig failed.
      • in Maven 2.2.1 - it doesn't work at all, even for first module; it returns "error code 1"

      However, I tried the same .pom - everything works perfectly in Linux (Ubuntu).

      I was afraid that it might be the issue with spaces, so I hardcoded the paths - the error I got from maven than was:

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign (signing) on project MyProject: Failed executing 'cmd.exe /X /C "C:\tools\JavaTMSEDevelopementKit\jre\..\bin\jarsigner.exe -verbose -keystore "C:\tmp\debug.keystore" -storepass '*****' -keypass '*****' xxx.jar '*****'debugkey"' - exitcode 1 -> [Help 1]
      

      Attaching pom file which I am using.
      Please help?

      1. pom.xml
        3 kB
        Anna Gadomska

        Activity

        Hide
        Chris Feldhacker added a comment -

        Possibly related tidbit to consider:
        We have Windows scripts to install various IDEs and local servers, which involves using keytool.exe to import needed certificates into keystores. When we ran the imports back-to-back, it would fail with files in use (sometime it would just hang).

        What we found was we had to impose a 3-5 second delay between commands before they would work. Don't know if its a Windows issue or perhaps an issue with some of the JDK tools, but perhaps something similar is happening here...

        Would be nice to at least have the option to NOT rename the file to .orig before signing...

        Show
        Chris Feldhacker added a comment - Possibly related tidbit to consider: We have Windows scripts to install various IDEs and local servers, which involves using keytool.exe to import needed certificates into keystores. When we ran the imports back-to-back, it would fail with files in use (sometime it would just hang). What we found was we had to impose a 3-5 second delay between commands before they would work. Don't know if its a Windows issue or perhaps an issue with some of the JDK tools, but perhaps something similar is happening here... Would be nice to at least have the option to NOT rename the file to .orig before signing...
        Hide
        Dennis Lundberg added a comment -

        Hi Kurt,

        Thanks for bringing a live project to the table. It is so much easier to debug when you have something real to work with.

        We have several projects at my day job that uses this plugin, and they all work fine on Windows. I tried to see what differed between your project and ours. I took a while but finally I stumbled upon this comment in our POMs:

                <!-- This needs to run after the Jarsigner plugin execution -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                ...
        

        The problem seems to be that both jarsigner and assembly plugins are bound to the package phase. At least in our case the assembly should contain the signed artifact. So I think Chris is right in assuming that there is some file locking problem that is specific to the Windows platform.

        Anyway the solution to this problem, and I have verified it on jUDDI, is to move the assembly execution so that it comes after the jarsigner execution in the POM. If this solves this issue for you I'll add an FAQ entry for it in the plugin documentation.

        Show
        Dennis Lundberg added a comment - Hi Kurt, Thanks for bringing a live project to the table. It is so much easier to debug when you have something real to work with. We have several projects at my day job that uses this plugin, and they all work fine on Windows. I tried to see what differed between your project and ours. I took a while but finally I stumbled upon this comment in our POMs: <!-- This needs to run after the Jarsigner plugin execution --> <groupId> org.apache.maven.plugins </groupId> <artifactId> maven-assembly-plugin </artifactId> ... The problem seems to be that both jarsigner and assembly plugins are bound to the package phase. At least in our case the assembly should contain the signed artifact. So I think Chris is right in assuming that there is some file locking problem that is specific to the Windows platform. Anyway the solution to this problem, and I have verified it on jUDDI, is to move the assembly execution so that it comes after the jarsigner execution in the POM. If this solves this issue for you I'll add an FAQ entry for it in the plugin documentation.
        Hide
        Kurt T Stam added a comment -

        Super Dennis, this fixed it for us! Cheers --Kurt

        Show
        Kurt T Stam added a comment - Super Dennis, this fixed it for us! Cheers --Kurt
        Hide
        Tony Chemit added a comment -

        Hi @Dennis, Have you add your entry in the project FAQ? I don't see it, could you done it to close this issue efore next release (I hope to do it soon after releasing maven-shared-utils, maven-jarsinger,...).

        Thanks.

        Show
        Tony Chemit added a comment - Hi @Dennis, Have you add your entry in the project FAQ? I don't see it, could you done it to close this issue efore next release (I hope to do it soon after releasing maven-shared-utils, maven-jarsinger,...). Thanks.
        Hide
        Tony Chemit added a comment -

        Entry added in FAQ at rev1553915

        Show
        Tony Chemit added a comment - Entry added in FAQ at rev1553915

          People

          • Assignee:
            Tony Chemit
            Reporter:
            Anna Gadomska
          • Votes:
            6 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: