How to setup Netbeans IDE to debug Maven JavaFx project on Raspberry remotely? - maven

I want to debug and run my Maven JavaFx project on Raspberry pi 3B+ from my workstation. I've tried Maven with Standard Java application and JavaFx application without Maven, in both situation it works successfully. But when I try with JavaFx Maven it gives me an error.
I've use "ssh-exec-maven-plugin" plugin with Maven Java Application and it works.
If Maven not used, both Java application and JavaFx can be remotely run with Netbeans Remote Runtime Platform. When I tried "ssh-exec-maven-plugin" plugin with Maven JavaFx project it gives me an error
Failed to execute goal org.rogueware.mojo:ssh-exec-maven-plugin:1.2:exec (default-cli) on project mavenproject1: Execution default-cli of goal org.rogueware.mojo:ssh-exec-maven-plugin:1.2:exec failed. NullPointerException -> [Help 1]
Resources that I've use,
https://www.raspberrypi.org/forums/viewtopic.php?p=1049839&sid=37a34bec94c20b0febe687740aba2488#p1049839
http://artem.gratchev.com/2015/03/java-application-jar-raspberry-pi-maven-eclipse/
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.erenay</groupId>
<artifactId>mavenproject1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mavenproject1</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>com.erenay.mavenproject1.MainApp</mainClass>
</properties>
<organization>
<!-- Used as the 'Vendor' for JNLP generation -->
<name>Your Organisation</name>
</organization>
<build>
<plugins>
<!-- PART I ADD -->
<plugin>
<groupId>org.rogueware.mojo</groupId>
<artifactId>ssh-exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<sshHost>10.0.0.124</sshHost>
<sshUsername>pi</sshUsername>
<sshPassword>123456</sshPassword>
<remoteExecutable>export DISPLAY=:0.0;java</remoteExecutable>
</configuration>
</plugin>
<!-- END of PART I ADD -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<excludeScope>system</excludeScope>
<excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/../bin/javafxpackager</executable>
<arguments>
<argument>-createjar</argument>
<argument>-nocss2bin</argument>
<argument>-appclass</argument>
<argument>${mainClass}</argument>
<argument>-srcdir</argument>
<argument>${project.build.directory}/classes</argument>
<argument>-outdir</argument>
<argument>${project.build.directory}</argument>
<argument>-outfile</argument>
<argument>${project.build.finalName}.jar</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/bin/java</executable>
<commandlineArgs>${runfx.args}</commandlineArgs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>${java.home}/lib/jfxrt.jar</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugins>
</build>
</project>
Also Project Properties->Actions->Run Project and Debug Project->Execute Goals
are replaced by clean package org.rogueware.mojo:ssh-exec-maven-plugin:1.2:exec
Thanks.

Related

How to generate "HTML Reports" using latest version (3.1.1) of jmeter-maven-plugin

I'm able to generate HTML reports when I use 2.8.0 version of jmeter-maven-plugin. I clearly see one folder target\jmeter\reports. However, when I use 3.1.1 (latest) version, I don't see this folder at all.
Please let me know if there is any way to generate HTML reports with the latest version.
Below is my sample of my pom.xml:
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.8.0</version>
<executions>
<!-- Run JMeter tests -->
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
<execution>
<id>configuration</id>
<goals>
<goal>configure</goal>
</goals>
</execution>
<!-- Fail build on errors in test -->
<execution>
<id>jmeter-check-results</id>
<goals>
<goal>results</goal>
</goals>
<configuration>
<generateReports>true</generateReports>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build> ```
This configuration block:
<configuration>
<generateReports>true</generateReports>
</configuration>
must be outside of the <execution> block
Full pom.xml just in case:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>jmeter</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>3.1.1</version>
<executions>
<!-- Generate JMeter configuration -->
<execution>
<id>configuration</id>
<goals>
<goal>configure</goal>
</goals>
</execution>
<!-- Run JMeter tests -->
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
<!-- Fail build on errors in test -->
<execution>
<id>jmeter-check-results</id>
<goals>
<goal>results</goal>
</goals>
</execution>
</executions>
<configuration>
<generateReports>true</generateReports>
</configuration>
</plugin>
</plugins>
</build>
</project>
More information:
JMeter Maven Plugin - Generating Reports
How to Use the JMeter Maven Plugin

How to run multiple jmeter .jmx tests with multiple input files using jmeter.maven.plugin

I need to be able to run jmeter tests from jenkins using mvn and jmeter-maven-plugin.
Here is the file setup:
test_dev.jmx
test_dev.txt
test_dev_regression.jmx
test_dev_regression.txt
Here is the pom file used by the mvn command (below):
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>JmeterTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>JMeter Example </name>
<properties>
<input.jmx.folder>${project.basedir}/src/test/jmeter</input.jmx.folder>
<input.jmx.file>test_${Environment}.jmx</input.jmx.file>
<input.csv>${project.basedir}/src/test/jmeter/test_${Environment}.txt</input.csv>
</properties>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.9.0</version>
<configuration>
<propertiesUser>
<threadgroup00.dataFile>${input.csv}</threadgroup00.dataFile>
</propertiesUser>
<testFilesIncluded>
<!-- If spcified, only particular file will be processed. -->
<jMeterTestFile>${input.jmx.file}</jMeterTestFile>
</testFilesIncluded>
<testResultsTimestamp>false</testResultsTimestamp>
<!-- This will pick up all the jmx file at below folder. -->
<testFilesDirectory>${input.jmx.folder}</testFilesDirectory>
<generateReports>true</generateReports>
<resultsFileFormat>csv</resultsFileFormat>
</configuration>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>test</phase>
<goals>
<goal>jmeter</goal>
<goal>results</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
And here is the command we are using to run the tests:
mvn verify -DEnvironment=$TEST_ENVIRONMENT
As you can see, currently there are no regression tests being run. I'd like to add the regression test and it's input file into this pom so that both tests get run one after the other. The hang-up for me is the <threadgroup00.dataFile> property. What needs to be specified here to use another input file for the regression test? Or is there another way to run multiple tests with multiple inputs using this framework?
Thanks in advance!
As of version 3.0.0 you should now be able to do this, an example execution block showing the setup is:
<executions>
<execution>
<id>configuration-one</id>
<goals>
<goal>configure</goal>
</goals>
<configuration>
<resultsFileFormat>xml</resultsFileFormat>
</configuration>
</execution>
<execution>
<id>configuration-two</id>
<goals>
<goal>configure</goal>
</goals>
<configuration>
<resultsFileFormat>csv</resultsFileFormat>
</configuration>
</execution>
<execution>
<id>performance test one</id>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<selectedConfiguration>configuration-one</selectedConfiguration>
<testFilesIncluded>
<jMeterTestFile>test1.jmx</jMeterTestFile>
</testFilesIncluded>
</configuration>
</execution>
<execution>
<id>performance test two</id>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<selectedConfiguration>configuration-two</selectedConfiguration>
<testFilesIncluded>
<jMeterTestFile>test2.jmx</jMeterTestFile>
</testFilesIncluded>
</configuration>
</execution>
</executions>
The IT test showing this behaviour (Which the above execution example was taken from) is available at here.

Concordion with Maven, using different folder for integration tests

I am trying to run integration tests (written in Concordion) using Maven 3.2.5. I have done the following.
Created a maven project using quickstart archetype.
Put my source code in src/main/java, unit test in src/test/java and integration
tests in src/spec/java.
Used maven-antrun-plugin to put integration test *.class in target/integrationtest-classes
Use maven-surefire-plugin to run the unit test cases.
Use maven-failsafe-plugin to run the integration test cases.
Finally run everything using "mvn clean install"
The problem is, while the unit test cases are running, the integration test cases are not. When I run the integration test cases from Eclipse, by running them as JUnit they run alright. However, when I run them from Maven, somehow only the unit test cases run. Can someone please help.
I am attaching my pom.xml here.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.acme.bundler</groupId>
<artifactId>concordion</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>concordion</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Integration test. -->
<integrationSourceDirectory>src/spec/java</integrationSourceDirectory>
<integrationOutputDirectory>target/integrationtest-classes</integrationOutputDirectory>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.concordion</groupId>
<artifactId>concordion</artifactId>
<version>1.4.6</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<!-- Compile and run using jdk 1.7 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<compilerArguments>
<d>${integrationOutputDirectory}</d>
</compilerArguments>
</configuration>
</execution>
</executions>
</plugin>
<!-- Run the main class of Java. -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.acme.bundler.concordion.App</mainClass>
<arguments>
<argument>foo</argument>
<argument>bar</argument>
</arguments>
</configuration>
</plugin>
<!-- The artefacts of integration tests need to move to a different folder
than the output of unit tests. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>create-directory</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Creating Directory ${integrationOutputDirectory}" />
<mkdir dir="${integrationOutputDirectory}" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<!-- Move the .class of the .java files in integration tests. <mkdir
dir="${itest.testOutputDirectory}" /> <move todir="${itest.testOutputDirectory}">
<fileset dir="${project.build.testOutputDirectory}"> <include name="**/*.class"
/> <present targetdir="${spec.testSourceDirectory}"> <mapper type="glob"
from="*.class" to="*.java" /> </present> </fileset> </move> -->
<!-- Surefire is designed to run the unit tests. If any of the tests
break the whole build breaks. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<test>**/*.java</test>
</configuration>
</plugin>
<!-- Failsafe is designed to run integration tests. -->
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.8</version>
<configuration>
<testClassesDirectory>${integrationOutputDirectory}</testClassesDirectory>
<reportsDirectory>${integrationOutputDirectory}/failsafe-reports</reportsDirectory>
<test>**/*.java</test>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<!-- Copy integration tests. -->
<execution>
<id>add-test-sources</id>
<phase>pre-integration-test</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${integrationSourceDirectory}</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-test-resources</id>
<phase>pre-integration-test</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${integrationSourceDirectory}</directory>
<targetPath>${integrationOutputDirectory}</targetPath>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>add-empty-directory</id>
<phase>pre-integration-test</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${integrationSourceDirectory}</directory>
<targetPath>${integrationOutputDirectory}</targetPath>
<excludes>
<exclude>**/*</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>

maven release plugin with phase and jar-with-dependencies

I have a build set up to run a variety of tasks when I run mvn release:prepare and mvn:release:perform. Specifically, I have a phase set up so that my javadocs and source-plugins are run only when I release. This allows my build to avoid a lot of time for the common case of mvn clean install. I'd like to add to this my maven-assembly-plugin jar-with-dependencies so only when I release the assembly plugin is run.
Here's what my build looks like:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>example</groupId>
<artifactId>example</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Example</name>
<build>
<plugins>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<doclet>org.asciidoctor.Asciidoclet</doclet>
<docletArtifact>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoclet</artifactId>
<version>0.1.3</version>
</docletArtifact>
<linksource>true</linksource>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
the maven-source-plugin and maven-javadoc-plugin both run during the release phase, but the maven-assembly-plugin does not. What do I have to do to make this plugin run during a maven release?
The single isn't bound to a default phase, so you have to specify it in the execution-block.
If you compare it with the javadoc:jar you'll see that this goal is by default bound to the package phase.

How to create executable jar using maven for Javafx Application with its dependent jars?

I want to create executable jar for my javafx application. I tried maven-assembly plugin and i am getting a cannot find class: com/application/Application. How to include jfxrt.jar in my executable jar.
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>XmlEditor</finalName>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<mainClass>MyApplication</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Thanks..
Here is a simple POM for a 'gangarajuprj' project. It is a good starting point for your application. (This POM is built using the NetBeans 7.4 RC2)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>co.prj</groupId>
<artifactId>gangarajuprj</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>gangarajuprj</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>co.prj.gangarajuprj.MainApp</mainClass>
</properties>
<organization>
<!-- Used as the 'Vendor' for JNLP generation -->
<name>Your Organisation</name>
</organization>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<excludeScope>system</excludeScope>
<excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/../bin/javafxpackager</executable>
<arguments>
<argument>-createjar</argument>
<argument>-nocss2bin</argument>
<argument>-appclass</argument>
<argument>${mainClass}</argument>
<argument>-srcdir</argument>
<argument>${project.build.directory}/classes</argument>
<argument>-outdir</argument>
<argument>${project.build.directory}</argument>
<argument>-outfile</argument>
<argument>${project.build.finalName}.jar</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>
</project>

Resources