sonatype / install4j-support

Install4j Support
http://sonatype.github.io/install4j-support/
11 stars 11 forks source link

maven build fails at install-license when install4j.home is not set #19

Closed AndreasSchaek closed 10 years ago

AndreasSchaek commented 10 years ago

The documentation says, that the goal insatll-license will be skipped, if install4j.home is not set or invalid. But when install4j.home is not set i get this error message and the build fails:

[ERROR] Failed to execute goal org.sonatype.install4j:install4j-maven-plugin:1.0.6:install-license (install-license) on project h-installer: The parameters 'installDir' for goal org.sonatype.install4j:install4j-maven-plugin:1.0.6:install-license are missing or invalid -> [Help 1]

When I set the variable to an invalid location, the goal is skipped. Since I dont want all clients to set a variable to an invalid location, I need the goal to be skipped, when the variable is not set.

jdillon commented 10 years ago

Sorry about that, you are right the docs and code are not in sync here.

I suggest you simply define a dummy property in your pom.xml for now. This is how we are presently using the plugin with this in the pom.xml of the project building the installers, and we override this in settings.xml to configure real details:

  <properties>
    <install4j.home>NOT_CONFIGURED</install4j.home>
    <install4j.winKeystorePassword>NOT_CONFIGURED</install4j.winKeystorePassword>
    <install4j.macKeystorePassword>NOT_CONFIGURED</install4j.macKeystorePassword>
    <install4j-support.version>1.0.6</install4j-support.version>
  </properties>

And I’ll try and find time to update the plugin so this is not needed, but no idea when I’ll find time ATM ;-)

AndreasSchaek commented 10 years ago

I'm about to look into the source and bugfix it. Do you want me to post a patch when I'm done?

AndreasSchaek commented 10 years ago

Well this one is pretty easy. Here's the patch since im unable to send it to the repository

install4j-maven-plugin/src/main/java/org/sonatype/install4j/maven/Install4jcMojoSupport.java 
index 4277708..3396b56 100644
@@ -41,7 +41,7 @@ public abstract class Install4jcMojoSupport
     /**
      * The location of the install4j installation.
      */
-    @Parameter(property = "install4j.home", required = true)
+    @Parameter(property = "install4j.home", required = false)
     protected File installDir;

     /**
@@ -62,7 +62,11 @@ public abstract class Install4jcMojoSupport

         AntHelper ant = new AntHelper(this, project);

-        if (!installDir.exists()) {
+        if (installDir == null) {
+            maybeFailIfMissing("install directory not set. Skipping build step");
+            return;
+        }
+        else if (!installDir.exists()) {
             maybeFailIfMissing("Invalid install directory: " + installDir);
             return;
         }
jdillon commented 10 years ago

fixed: https://github.com/sonatype/install4j-support/commit/30ba2c0c3e665596ed26eddc55c1c0e63e87b868

thx

jdillon commented 10 years ago

please verify and I'll start a release

AndreasSchaek commented 10 years ago

tested and working.

jdillon commented 10 years ago

1.0.7 released, updating site now