install4j 5.1.5 - Signing: disable at command line or maven plugin not possible - signing

Today I integrated the signing process to our project. It works fine. Now I tried to disable the signing process at the maven-plugin:
<plugin>
<groupId>org.sonatype.install4j</groupId>
<artifactId>install4j-maven-plugin</artifactId>
<version>1.0.5</version>
<executions>
<execution>
<id>build-installer</id>
<phase>prepare-package</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<projectFile>${project.build.outputDirectory}/${install4j.projectFile}</projectFile>
<destination>${project.build.directory}/installer</destination>
<disableSigning>${disableSigning}</disableSigning>
<!-- password for keystore has to be set as system property -->
<winKeystorePassword>${certificate.keystore.psw}</winKeystorePassword>
</configuration>
</execution>
</executions>
</plugin>
Then I was calling our maven build with the following command:
mvn clean prepare-package -DdisableSigning=true
and got the following error message:
[INFO] --- install4j-maven-plugin:1.0.5:compile (build-installer) # ForumViewerInstaller ---
[INFO] install4j: Unknown option '--disable-signing'
[INFO] Usage: install4jc [OPTIONS] [config file]
[INFO] Try 'install4jc --help for more information'
It looks like the maven-plugin is not compatible with install4j 5 anymore, is it? Or could it be a problem with my install4j configuration?
Thanks for any solution
Hardie

This is a bug that will be fixed in install4j 5.1.11. Currently only the short form -u works.

Related

MAVEN: No plugin found for prefix 'dependency' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo]

[ERROR] No plugin found for prefix 'dependency' in the current project
and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo]
available from the repositories [local
(C:\Users\mdhore.m2\repository), central
(https://repo.maven.apache.org/maven2)] -> [Help 1]
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<!-- configure the plugin here -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
according to this you have to provide group and artifact id. I run mvn dependencies:tree like the following and it worked.
mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:tree -Dverbose=true
I got this error when I forgot to add this parameter. I have to add to each of my Maven comamnds to autheticate with my Maven remote repository.
-Djava.net.ssl.trustStore=cacerts.jks. If you don't normally add a parameter like this you probably have another issue.
I have also encountered the same issue. I typed the wrong command mvn dependences:resolve, the correct one is mvn dependency:resolve.
I got the same error and in my case I didn't have the POM file in the same directory I was in.
make sure there is no import error anywhere in your code then run mvn dependency:tree the error will be gone. I assume you are using mvn and you have some import issue somewhere in your project.

Can't run and debug groovy tests under intellij idea

I try to embed groovy test to java project.
I start with spock examples - https://github.com/spockframework/spock-example
Examples is compile and execute by running maven goal test but if i try to run test under intellij idea (ctrl+F10 under test method) it failure with classpath error.
Error running HelloSpockSpec.length of Spock's and his friends' names:
Class 'HelloSpockSpec' not found in module 'spock-example'
I try to apply advices from IntelliJ + Groovy + Spock but it didn't help.
Don't forget to mark the folder as "Test Sources" in IntelliJ
Then it should work as expected :-)
Intellij can automatically add the groovy source as a source directory based on your pom. Add build-helper-maven-plugin config to your maven pom under plugins specifying ${basedir}/src/test/groovy as a source dir:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-groovy-test-source</id>
<phase>test</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/test/groovy</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>

How to stop Apache maven <outputDirectory> to overwrite the folder

I have the following directory hierarchy:
generated
|
| -->java
Java directory has the following package: com.model
that contains java models that I copy/paste from somewhere before I compile the application.
The issue that I use Protocol buffer and I tell maven to output the generated files on same previous directory BUT over a new package:
Result : Protocol buffer generates the new package and deletes the old package.
I have no idea why does it do that although the package names are different?
Here is that part of pom I use to generate java from protocol buffer:
<plugin>
<groupId>com.google.protobuf.tools</groupId>
<artifactId>maven-protoc-plugin</artifactId>
<configuration>
<protocExecutable>C:\protoc.exe</protocExecutable>
<protoSourceRoot>./src/proto</protoSourceRoot>
<outputDirectory>./src/generated/java</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
if you look at the code for the plugin you'll see that the code has been hardcoded to clean the directory:
https://github.com/dtrott/maven-protoc-plugin/blob/master/src/main/java/com/google/protobuf/maven/AbstractProtocMojo.java#L154
// Quick fix to fix issues with two mvn installs in a row (ie no clean)
cleanDirectory(outputDirectory);
There's 2 ways to solve this..either set the output directory to a temp directory and then use the maven copy plugin or the maven build plugin to copy the files into the directory of your choice, or modify the maven plugin to remove that line (or better yet make it configurable).
Tommy
I have solved my issue by the following :
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<delete dir="./destination"/>
<copy todir="./destination">
<fileset dir="./source"/>
</copy>
<delete dir="./source"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
However , I get this error "An Ant BuildException has occured: Only one of tofile and todir may be set"

Maven: copying directories using exec plugin

I'm using Maven 3.0.3. I'm having trouble using the Maven exec plugin to copy the contents of one directory to another. Sadly, when I include this plugin in my pom.xml …
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<executable>cp</executable>
<arguments>
<argument>-r</argument>
<argument>web-app/*</argument>
<argument>src/main/webapp</argument>
</arguments>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
It isn't working. I get the error below …
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1.1:exec (default-cli) on project jx: Result of /bin/sh -c cd /Users/davea/Documents/workspace/mycoUSA2/Technology/nna/myco2usa/jx && cp -r 'web-app/*' src/main/webapp execution is: '1'. -> [Help 1]
Does anyone know how I can modify my plugin config to copy the contents of one directory to another? Thanks, - Dave
If you are using bash, try the following:
<executable>bash</executable>
<arguments>
<argument>-c</argument>
<argument>cp -r web-app/* src/main/webapp</argument>
</arguments>
This spawns a new bash and gives it the command cp -r web-app/* src/main/webapp to execute.
You can also test if it works for you by inputting this into a normal Terminal window first:
bash -c "cp -r web-app/* src/main/webapp"
Note that the " signs do make a difference as the exec-maven-plugin does insert them automatically, thus they are not included in the <argument>-tag.
Note the command it ran. From the error output:
cp -r 'web-app/*' src/main/webapp
Note in particular the 'web-app/*' file it has tried to copy. Because it has quoted this argument the cp command is looking for a specific file with the name * in the web-app directory. Because you don't have a file with this name it has exited with the error code 1.
The maven-resources-plugin has a goal designed to perform this task. Why not give it a try? It would have the added benefit of making your build platform independent.
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/web-app</outputDirectory>
<resources>
<resource>
<directory>web-app</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
mvn -X might be more revealing
Many people would use the maven-antrun-plugin and script this in ant so as to get a portable solution.

How to execute a jar from pom.xml

I want to create a build info file into the specific location of the project's target folder (especially in target/abc_project/META-INF folder) through maven-2.
Following is what I am doing in the pom.xml
<build>
<finalName>abc_project</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<id>buid-info-generator</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<arguments>
<argument>-jar</argument>
<argument>xyz.jar</argument>
<argument>target/abc_project/META-INF/info.txt</argument>
<argument>date</argument>
<argument>hg summary</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugins>
</build>
while giving the phase other than install, deploy, I get the following error -
[INFO] Exception in thread "main" java.io.FileNotFoundException: target\abc_project\META-INF\info.txt (The system cannot find the path specified)
[INFO] at java.io.FileOutputStream.open(Native Method)
[INFO] at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
[INFO] at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
[INFO] at java.io.FileWriter.<init>(FileWriter.java:73)
[INFO] at com.nbec.svn.build.info.BuildInfoGenerator.main(BuildInfoGenerator.java:30)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Result of cmd.exe /X /C "java -jar xyz.jar target/abc_project/META-INF/info.txt "date "hg summary"" execution is: '1'.
But strangely, the same code is working for 1 project and not for other 2 projects. Is there any alternative to obtain the same.
Actually the error report indicates that the directory target\abc_project\META-INF probably does not exist. Without more information I can only speculate. Maybe the plugin which create the abc_project\META-INF directory is called after the exec-maven-plugin.