Why my java program is failing to load maven plugin? - java

I am working on JAVAFX application, and I am using pom.xml file, in which I have dependencies, It was working well in my last computer, but when I imported it to another pc than it is giving me an error, that failed to execute maven plugin, I have searched over internet, and followed all possible solutions, given out there, but all doesn't worked for me.
Now I have a question, that why I am getting this error that failed to load maven plugin?
here is the log trace:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project EmployeeManagement: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
and here is my 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.viremp</groupId>
<artifactId>EmployeeManagement</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>EmployeeManagement</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>com.viremp.employeemanagement.MainApp</mainClass>
</properties>
<organization>
<!-- Used as the 'Vendor' for JNLP generation -->
<name>VirEmp Technologies International</name>
</organization>
<build>
<plugins>
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.6.0</version>
<configuration>
<mainClass>com.viremp.employeemanagement.MainApp</mainClass>
<bundler>EXE</bundler>
<needShortcut>true</needShortcut>
<appName>Employee Management System</appName>
</configuration>
<executions>
<execution>
<id>create-jfxjar</id>
<phase>package</phase>
<goals>
<goal>build-jar</goal>
</goals>
</execution>
<execution>
<id>create-native</id>
<phase>package</phase>
<goals>
<goal>build-native</goal>
</goals>
</execution>
</executions>
</plugin>
<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/javapackager</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>8</source>
<target>8</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>
<dependencies>
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>1.3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
Thanks in advance!!

The exec plugin executes a binary in the path ${java.home}/../bin/javapackager.
When executing it it returns an errorcode of 1, which is likely to be that it could not find the binary.
Check that you have a valid JAVA_HOME and that javapackager exist.
Perhaps you have a jre on the new machine?

I have resolved this issue, actually it was throwing an error failed to execute because of some other build errors in my code, which were related to MySQL, before that I was thinking that let me first resolve this plugin error than I will remove that error, but when I haven't got any suitable answer, so than I thought to remove other errors, than I will come back to this and will remove this error, but when I removed my other errors, than the magic happened, and all error goes, that MySQL as well as plugin errors.
Don't know why, but it did the trick for me.
Don't know why by removing other errors, removed this issue too, what's the relation between all this.

Related

Errors in maven pom defined by IntelliJ IDEA

This question was posted before but with very little information and no solution.
I'm getting an error in my pom file: "Cannot resolve symbol 'runfx.args'"
My project is a maven project based on the javafx archetype. The pom was automatically generated by intelliJ and I only added the JDA dependency and bintray repository (for the JDA dependency) that are the bottom of the pom.
If it is relevant, I can run the program trough IntelliJ without using maven.
maven install and maven compile work without errors but maven deploy throws the following error:
Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.6:unpack-dependencies (unpack-dependencies) on project MessageSpreadBot: Unknown archiver type: No such archiver: 'pom'. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven->dependency-plugin:2.6:unpack-dependencies (unpack-dependencies) on project MessageSpreadBot: Unknown archiver type
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at >org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at >sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at >sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at >org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at >org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at >org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at >org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unknown archiver type
at >org.apache.maven.plugin.dependency.AbstractDependencyMojo.unpack(AbstractDependencyMojo.java:281)
at >org.apache.maven.plugin.dependency.UnpackDependenciesMojo.execute(UnpackDependenciesMojo.java:91)
at >org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at >org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 21 more
Caused by: org.codehaus.plexus.archiver.manager.NoSuchArchiverException: No >such archiver: 'pom'.
at >org.codehaus.plexus.archiver.manager.DefaultArchiverManager.getUnArchiver(DefaultArchiverManager.java:77)
at >org.codehaus.plexus.archiver.manager.DefaultArchiverManager.getUnArchiver(DefaultArchiverManager.java:122)
at >org.apache.maven.plugin.dependency.AbstractDependencyMojo.unpack(AbstractDependencyMojo.java:242)
... 24 more
Here is the full pom:
<?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>ArthurSilva</groupId>
<artifactId>MessageSpreadBot</artifactId>
<version>1.0</version>
<name>MessageSpreadBot</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>ArthurSilva.MainApp</mainClass>
</properties>
<organization>
<!-- Used as the 'Vendor' for JNLP generation -->
<name>KON</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>
<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>8</source>
<target>8</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>
<dependencies>
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>3.8.3_464</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
</project>
Thanks
Edit: I tried changing the maven-dependency-plugin version to 3.1.1 and it failed maven install, I changed back to 2.6 and it still fails install. Gives the same error as the one above. I tried cleaning then compiling but it still doesn't work.
I used your pom and the problem is that the plugin tries to unpack a pom.
Unpacking d:\Profiles\aclaudel.m2\repository\club\minnced\opus-java\1.0.4\opus-java-1.0.4.pom to D:\tmp\target\classes with includes "" and excludes ""
[ERROR] [...] Unknown archiver type: No such archiver: 'pom'.
A workaround is to exclude the artifact in the plugin configuration :
<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>
<excludeArtifactIds>opus-java</excludeArtifactIds>
<excludeScope>system</excludeScope>
<excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

Maven generate-sources "Some problems were encountered while building the effective model for "

I don't understand, sometimes It works and sometimes not....
I am trying to use generate-sources goal, but I received this message:
[WARNING] Some problems were encountered while building the effective model for SoapClientSd:SoapClientSd:jar:0.0.2
[WARNING] Reporting configuration should be done in <reporting> section, not in maven-site-plugin <configuration> as reportPlugins parameter. # line 139, column 20
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[INFO] ---------------------< SoapClientSd:SoapClientSd >-------------------
[INFO] Building SoapClientSd 0.0.2
[INFO] --------------------------------[ jar ]------------------------------
[INFO] BUILD SUCCESS
[INFO] Total time: 0.250 s
[INFO] Finished at: 2018-10-08T21:46:21+02:00
Here my pom:
<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>SoapClientSd</groupId>
<artifactId>SoapClientSd</artifactId>
<version>0.0.2</version>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<properties>
<jdk.source>1.7</jdk.source>
<jdk.target>1.7</jdk.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<wsdl>http://localhost:8080/SoapSd/UniboServices?wsdl</wsdl>
<ws.stub.package.name>it.unibo.test.services</ws.stub.package.name>
<log4j.version>1.2.17</log4j.version>
<commons-io.version>2.4</commons-io.version>
<commons-logging.version>1.2</commons-logging.version>
<cxf.version>2.5.2</cxf.version>
<maven-javadoc-plugin.version>2.10.3</maven-javadoc-plugin.version>
<maven-source-plugin.version>3.0.0</maven-source-plugin.version>
<maven-compiler-plugin.version>3.6.1</maven-compiler-plugin.version>
</properties>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2java</goal>
</goals>
<configuration>
<tasks>
</tasks>
<sourceRoot>target/generated-sources</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${wsdl}</wsdl>
<extraargs>
<extraarg>-verbose</extraarg>
<extraarg>-client</extraarg>
<extraarg>-frontend</extraarg>
<extraarg>jaxws21</extraarg>
<extraarg>-p</extraarg>
<extraarg>${ws.stub.package.name}</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${jdk.source}</source>
<target>${jdk.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</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>${maven-javadoc-plugin.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<additionalparam>${javadoc.opts}</additionalparam>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>${javadoc.opts}</additionalparam>
</configuration>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<version>${cxf.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>
</project>
What am I doing wrong? Why I get this error? I just run "generated sources" again after a while and It doesn't work. I also try with -X, and clean, but It doesn't work.
To generate-sources your application must be started.
Check if you can access http://localhost:8080/SoapSd/UniboServices?wsdl
try to close all target/generated-sources folders

Maven Jacoco plugin not generating report

I've been working in Java Eclipse with a Maven project for school. I've been using Eclemma for code coverage data, but my professor wants to run my code from the command line and get a code coverage report from there. I've been trying to get Jacoco to work, but I really have never worked with Maven or Pom.xmls before and am pretty lost. Thise is what mine looks like at the moment
<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> yada yada yada </groupId>
<artifactId> yada yada yada </artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.ant</artifactId>
<version>0.8.1</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.1</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>target/jacoco.exec</dataFile>
<outputDirectory>target/jacoco-ut</outputDirectory>
</configuration>
</execution>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<mainClass> yada yada yada </mainClass>
</configuration>
<executions>
<execution>
<id>run-selenium</id>
<phase>integration-test</phase>
<goals><goal>java</goal></goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<!-- nothing -->
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
When I execute
$> mvn clean test jacoco:report
or just jacoco:report, I get
[INFO] --- jacoco-maven-plugin:0.8.1:report (default-cli) # MyFileLocation ---
[INFO] Skipping JaCoCo execution due to missing execution data file.
Not sure what to do at this point...
Check plugins
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.4.0.905</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<configuration>
<destFile>${sonar.jacoco.reportPath}</destFile>
<append>true</append>
</configuration>
<executions>
<execution>
<id>agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
Add only This plugins
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<configuration>
<destFile>${sonar.jacoco.reportPath}</destFile>
<append>true</append>
</configuration>
<executions>
<execution>
<id>agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
To record coverage using JaCoCo you need to execute tests with JaCoCo Java agent.
According to https://www.jacoco.org/jacoco/trunk/doc/prepare-agent-mojo.html :
Prepares a property pointing to the JaCoCo runtime agent that can be passed as a VM argument to the application under test.
By default it sets property argLine which is picked by maven-surefire-plugin, however seems that you are not actually using maven-surefire-plugin and instead using java goal of exec-maven-plugin, which
first of all doesn't start new JVM - see https://www.mojohaus.org/exec-maven-plugin/java-mojo.html :
Executes the supplied java class in the current VM
second - doesn't use argLine
So make sure that JaCoCo agent is used during your tests, e.g. use exec goal of exec-maven-plugin and pass argLine to it - see https://www.mojohaus.org/exec-maven-plugin/exec-mojo.html#arguments

How fix ORA-00604 and ORA-12705 during sql-maven-plugin execution?

I am trying to drop tablespace in oracle via maven plugin. Here is the configuration:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<dependency>
<groupId>oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
</dependencies>
<configuration>
<driver>oracle.jdbc.driver.OracleDriver</driver>
<url>jdbc:oracle:thin:#localhost:1521:XE</url>
<username>system</username>
<password>1</password>
</configuration>
<executions>
<execution>
<id>drop</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<autocommit>true</autocommit>
<sqlCommand>DROP TABLESPACE myTableSpace INCLUDING CONTENTS and DATAFILES;</sqlCommand>
<onError>continue</onError>
</configuration>
</execution>
<executions>
<plugin
This leads to the following error:
[ERROR] Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.5:execute (drop) on project database-migration: ORA-00604: error occurred at recursive SQL level 1
[ERROR] ORA-12705: Cannot access NLS data files or invalid environment specified
I have googled already and tried to set NLS_LANG both via maven plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>set-system-properties</goal>
</goals>
<configuration>
<properties>
<property>
<name>NLS_LANG</name>
<value>AMERICAN_AMERICA.UTF8</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>
And command line (windows):
SET NLS_LANG=AMERICAN_AMERICA.UTF8
echo %NLS_LANG%
AMERICAN_AMERICA.UTF8
But got same error.
Also please note that with Intellij Idea I have same connection settings and same user/pass and can drop this tablespace without any errors.
Why I can not do this via maven? How to fix this issue?

Adding maven support for project messed up loading of images/working with paths

I had a project which i moved to maven, since it makes it easy for me to work with dependencies , after i did that build works alright bud my execution stops at loading a resource (image) from one of my packages.Im lost since everything works well on old build without maven.
I load image
primStage.getIcons().add(new Image(OpenChannel_Dynamic_Downloader.class
.getResourceAsStream(Info.Resource.OCPI)));
Resource location is specified here
public static final String OCPI = "/openchannel_dynamic_downloader/resources/images/openChannelPlaceholderIcon.png";
My whole package structure is same , all the names everything.
Exception that i get is :
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Input stream must not be null
at javafx.scene.image.Image.validateInputStream(Image.java:1110)
at javafx.scene.image.Image.<init>(Image.java:694)
at openchannel_dynamic_downloader.application.OpenChannel_Dynamic_Downloader.lambda$showLoginWindow$10(OpenChannel_Dynamic_Downloader.java:233)
at com.sun.javafx.application.PlatformImpl.lambda$null$174(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$149(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
Problematic line is the first code snipped. Has anyone seen this issue before? Do i ahve to change hwo i work with paths when i put in maven? Im pretty much a newbie to whole maven so woud be nice if you can help me with this since i expected this to work without an issue.
Here is my 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.bisciak</groupId>
<artifactId>OpenChannel_Dynamic_Downloader_MavenEnabled</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<name>OpenChannel_Dynamic_Downloader_MavenEnabled</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>openchannel_dynamic_downloader.application.OpenChannel_Dynamic_Downloader</mainClass>
</properties>
<organization>
<!-- Used as the 'Vendor' for JNLP generation -->
<name>Tomas Bisciak's software</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>
<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.8</source>
<target>1.8</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>
<dependencies>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>8.40.10</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.190</version>
</dependency>
<dependency>
<groupId>net.java.openjfx.backport</groupId>
<artifactId>openjfx-78-backport</artifactId>
<version>1.8.0-ea-b96.1</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>com.1stleg</groupId>
<artifactId>jnativehook</artifactId>
<version>2.0.2</version>
</dependency>
</dependencies>
</project>
Image is correctly located at the specified package/location and code was not modified since my migration,is this maven related?
Package structure:
When working with Maven, all resources should be placed under src/main/resources. By resources, I mean every file that should be packaged into the final JAR, i.e. every file that should be present in the classpath.
Since you are using Class.getResourceAsStream() to access your images, they must reside under that folder.
As such, you should move your resources under src/main/resources. The final location for the image would be: src/main/resources/openchannel_dynamic_downloader/resources/images/openChannelPlaceholderIcon.png
I prefer to load images when working with Maven and JavaFx in this way:
1) Put image into src/main/resources/images/image.png.
2) Create javafx.scene.image.Image object:
ClassLoader classLoader = getClass().getClassLoader();
String imageUrl = classLoader.getResource("images/image.png").toExternalForm();
Image image = new Image(imageUrl);

Categories