I would like to ask on how to get rid of these errors. Once I've run my Maven test without failed test. There's no error on my project. but once I tried to put a failed test case in my Project This error is showing up. Please advise. I tried to look for a solution for 2 days already :( but can't find
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project Automation.ProjectName: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\Administrator\workspace\Automation.ProjectName\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
POM.XML CODE:
<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.package</groupId>
<artifactId>Automation.ProjectName</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.9</version>
</dependency>
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.14</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<compilerVersion>1.8</compilerVersion>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/main/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
Related
i am testing Automation engineer, I have configured Jenkins and maven project for the automate the scripts, some days ago my all scripts were working good in Jenkins and locally, but Now when I run build in Jenkins and locally system through exception, locally when I tries to update my maven project and run scripts through command "maven test" its working fine and all scripts running when i tries to run command "maven clean " and then run command run as "maven test" then system generates me an error , when i try to run same porm.xml file from jenkins without command "clean test" its working fine but with command always facing same kind of exception
.
"ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on project EventBuizz: Compilation failure
[ERROR] /E:/Automation/eclipse-workspace/EventBuizz/src/test/java/EventBuizz/EventBuizz/EventCenterDashBoard.java:[21,34] package org.apache.tools.ant.types does not exist
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:"
I have looked through the other posts for this and made some changes to my .pom file as suggested but I am still stuck with the same error. Unsure what other useful info to provide so please let me know what other info would be useful to troubleshoot this. Below is my .pom file
<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>EventBuizz</groupId>
<artifactId>EventBuizz</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-dependency-tree</artifactId>
<version>3.0.1</version>
</dependency>
<!-- Selenium -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<!-- TestNG -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
<!--JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<!--Maven Plugin -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<type>maven-plugin</type>
</dependency>
<!--Extent Report -->
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
</dependency>
<dependency>
<!-- jsoup HTML parser library # https://jsoup.org/-->
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.12.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<!--Maven Plugin -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
</configuration>
</plugin>
<!--Maven surfire plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.8</version>
<configuration>
<printSummary>true</printSummary>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
i want to run my test scripts in jenkins with command "clean test".
testCompile phase compiles the application test sources. If this phase fails, then the test Phase will fail.
Check the error you are getting -
Compilation failure [ERROR] /E:/Automation/eclipse-workspace/EventBuizz/src/test/java/EventBuizz/EventBuizz/EventCenterDashBoard.java:[21,34] package org.apache.tools.ant.types does not exist
I would start debugging it by checking this class. It seems that the library - org.apache.tools.ant.types is missing in your project.
I have little maven project that uses com.sun.istack.internal.Nullable.
I tried both JDK 9 and 1.8, and still get error about package does not exists.
I search for the package and find some: https://mvnrepository.com/search?q=+com.sun.istack but they still not supply necessary one.
The JAVA_HOME:
apshenichnikov#IAS-WS-UX02:~/NetBeansProjects/newlps$ echo $JAVA_HOME
/usr/local/java/jdk1.8.0_121/
And JDK:
apshenichnikov#IAS-WS-UX02:~/NetBeansProjects/newlps$ sudo update-alternatives --config java
There are 4 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-9-oracle/bin/java 1091 auto mode
1 /usr/lib/jvm/java-8-oracle/jre/bin/java 1081 manual mode
2 /usr/lib/jvm/java-9-oracle/bin/java 1091 manual mode
* 3 /usr/local/java/jdk1.8.0_121/ 1 manual mode
4 /usr/local/java/jdk1.8.0_121/bin/java 1 manual mode
Press <enter> to keep the current choice[*], or type selection number:
And the POM.xml:
<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>ru.beinteractive</groupId>
<artifactId>newlps</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>newlps</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.google.code.externalsortinginjava</groupId>
<artifactId>externalsortinginjava</artifactId>
<version>0.1.9</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<compilerArgument>-XDignore.symbol.file</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/libs
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
I injected:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<compilerArgument>-XDignore.symbol.file</compilerArgument>
</configuration>
</plugin>
Inside the POM.xml
And I still have compilation exception
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.286 s
[INFO] Finished at: 2017-12-13T15:28:45+03:00
[INFO] Final Memory: 20M/261M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project newlps: Compilation failure: Compilation failure:
[ERROR] /home/apshenichnikov/NetBeansProjects/newlps/src/main/java/su/ias/utils/ParamUtils.java:[3,31] package com.sun.istack.internal does not exist
[ERROR] /home/apshenichnikov/NetBeansProjects/newlps/src/main/java/su/ias/utils/StringUtils.java:[3,31] package com.sun.istack.internal does not exist
[ERROR] /home/apshenichnikov/NetBeansProjects/newlps/src/main/java/su/ias/utils/ParamUtils.java:[36,74] cannot find symbol
[ERROR] symbol: class Nullable
[ERROR] location: class su.ias.utils.ParamUtils
[ERROR] /home/apshenichnikov/NetBeansProjects/newlps/src/main/java/su/ias/utils/ParamUtils.java:[46,68] cannot find symbol
[ERROR] symbol: class Nullable
[ERROR] location: class su.ias.utils.ParamUtils
[ERROR] /home/apshenichnikov/NetBeansProjects/newlps/src/main/java/su/ias/utils/StringUtils.java:[19,36] cannot find symbol
[ERROR] symbol: class Nullable
[ERROR] location: class su.ias.utils.StringUtils
[ERROR] /home/apshenichnikov/NetBeansProjects/newlps/src/main/java/su/ias/utils/StringUtils.java:[45,6] cannot find symbol
[ERROR] symbol: class Nullable
[ERROR] location: class su.ias.utils.StringUtils
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Try import import org.jetbrains.annotations.Nullable instead. It has the same you need for #Nullable annotation.
Then add this dependency:
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>13.0</version>
</dependency>
I try to setup a Struts2 project with maven und IntelliJ as IDE.
But maven can't find most of the dependencies. For example:
org.apache.struts:struts2-core:2.5.5
https://mvnrepository.com/artifact/org.apache.struts/struts2-core/2.5.5
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></groupId>
<artifactId>brw</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>brw</name>
<properties>
<struts2.version>2.5.5</struts2.version>
<log4j2.version>${log4j2.version}</log4j2.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-junit-plugin</artifactId>
<version>${struts2.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.16.v20140903</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>xwork.loggerFactory</name>
<value>com.opensymphony.xwork2.util.logging.log4j2.Log4j2LoggerFactory</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
<webAppConfig>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
</configuration>
</plugin>
</plugins>
</build>
</project>
error
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Resolving expression: '${log4j2.version}': Detected the following recursive expression cycle in 'log4j2.version': [log4j2.version] #
[ERROR] Resolving expression: '${log4j2.version}': Detected the following recursive expression cycle in 'log4j2.version': [log4j2.version] #
[ERROR] 'dependencies.dependency.version' for org.apache.logging.log4j:log4j-core:jar must be a valid version but is '${log4j2.version}'. # line 41, column 22
#
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project de.sambohl.brw:brw:1.0-SNAPSHOT (/Users/philipp/IdeaProjects/brw/pom.xml) has 3 errors
[ERROR] Resolving expression: '${log4j2.version}': Detected the following recursive expression cycle in 'log4j2.version': [log4j2.version] -> [Help 2]
[ERROR] Resolving expression: '${log4j2.version}': Detected the following recursive expression cycle in 'log4j2.version': [log4j2.version] -> [Help 2]
[ERROR] 'dependencies.dependency.version' for org.apache.logging.log4j:log4j-core:jar must be a valid version but is '${log4j2.version}'. # line 41, column 22
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/InterpolationCycleException
Process finished with exit code 1
Your problem is here
<log4j2.version>${log4j2.version}</log4j2.version>
Indeed your error means that "${log4j2.version}" is not a valid version.
You are supposed to set explicitly a version of log4j2 instead of "${log4j2.version}" for example you could use 2.7 if you want to use the latest version (which is also the version on which org.apache.struts:struts2-core:2.5.5 relies), see the list of existing versions here.
So try this
<log4j2.version>2.7</log4j2.version>
Problem is with < log4j2.version > property.
Property in a POM file is expected to be a constant value which can be replaced when the property is referred. But in your case you'r pointing to the same property which is an error.
if you want to include a specific version then provide it in < log4j2.version> tag like:
< log4j2.version>1.2.17< /log4j2.version>
or you can use
< log4j2.version>LATEST< /log4j2.version>,
'LATEST' keyword can automatically pick the latest version of the dependency from maven repository
package my.helloworld;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import org.junit.Test;
public class HomeControllerTest {
}
The above is my test code. Even this empty code isn't compiling. Below is my pom.xml:
<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>my.helloworld</groupId>
<artifactId>spring-helloworld</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>spring-helloworld</name>
<url>http://maven.apache.org</url>
<properties>
<jdk.version>1.6</jdk.version>
<spring.version>3.2.13.RELEASE</spring.version>
<jstl.version>1.2</jstl.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<!-- embedded Jetty server, for testing -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.11.v20150529</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webApp>
<contextPath>/spring3</contextPath>
</webApp>
</configuration>
</plugin>
<!-- configure Eclipse workspace -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<wtpversion>2.0</wtpversion>
<wtpContextName>spring3</wtpContextName>
</configuration>
</plugin>
</plugins>
</build>
</project>
now when I run mvn jetty:run or mvn clean install or mvn test, i get the following error :
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile (default-testCompile) on project spring-helloworld: Compilation failure: Compilation failure:
[ERROR] /home/kay/Projects/Spring/MVC/HelloWorld/spring-helloworld/src/test/java/my/helloworld/HomeControllerTest.java:[3,1] package org.springframework.test.web.servlet.result.MockMvcResultMatchers does not exist
[ERROR] /home/kay/Projects/Spring/MVC/HelloWorld/spring-helloworld/src/test/java/my/helloworld/HomeControllerTest.java:[7,17] package org.junit does not exist
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Earlier, it was giving error that package org was not found. What am I missing here?
The class org.springframework.test.web.servlet.result.MockMvcResultMatchers you are trying to import is part of the spring-test module. Add that as a test dependency, because otherwise, it will not be on your classpath and thus, your compiler cannot find it.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
And if you don't import something that comes from org.*, then the compiler will not find the package org. But to say something more exact about that, we would need the code and preferably the error message.
Have you tried removing <scope>test</scope> to see whether it works then?
I have a Java FX project and am using maven 3.0.5 to build. When i run mvn package/install, the project fails and complains that the package javafx.* doesn't exist. Javafx is packaged in Java 1.7 to my understanding so it doesn't make sense that the build does not pick this up. When i compile it within my IDE (intellij) it works fine and after that my maven build also successfully installs, however i do not wish to have to go through the IDE every time i do a clean install. any ideas?
here is my 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">
<parent>
<artifactId>thenaglecode</artifactId>
<groupId>com.thenaglecode</groupId>
<version>1.0.0.Pre-Alpha</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>system-setup</artifactId>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<includeEmptyDirs>true</includeEmptyDirs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<jre>
<path>C:\Program Files\Java\jre7</path>
<minVersion>1.7.0</minVersion>
<initialHeapSize>128</initialHeapSize>
<maxHeapSize>1024</maxHeapSize>
</jre>
<jar>${project.build.directory}/${project.build.finalName}.jar</jar>
<outfile>${project.build.directory}/systemsetup.exe</outfile>
<classPath>
<mainClass>com.thenaglecode.Start</mainClass>
</classPath>
<singleInstance>
<mutexName>thenaglecode-system-setup</mutexName>
</singleInstance>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
And here is my Log:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/Macindows/IdeaProjects/thenaglecode/system-setup/src/main/java/com/thenaglecode/CommandHelper.java:[3,26] package javafx.application does not exist
[ERROR] /C:/Users/Macindows/IdeaProjects/thenaglecode/system-setup/src/main/java/com/thenaglecode/ListAndOptionsController.java:[3,26] package javafx.beans.value does not exist
[ERROR] /C:/Users/Macindows/IdeaProjects/thenaglecode/system-setup/src/main/java/com/thenaglecode/ListAndOptionsController.java:[4,26] package javafx.beans.value does not exist
[ERROR] /C:/Users/Macindows/IdeaProjects/thenaglecode/system-setup/src/main/java/com/thenaglecode/ListAndOptionsController.java:[5,26] package javafx.collections does not exist
[ERROR] /C:/Users/Macindows/IdeaProjects/thenaglecode/system-setup/src/main/java/com/thenaglecode/ListAndOptionsController.java:[6,20] package javafx.event does not exist
[ERROR] /C:/Users/Macindows/IdeaProjects/thenaglecode/system-setup/src/main/java/com/thenaglecode/ListAndOptionsController.java:[7,20] package javafx.event does not exist
...
[ERROR] /C:/Users/Macindows/IdeaProjects/thenaglecode/system-setup/src/main/java/com/thenaglecode/Context.java:[3,28] package javafx.scene.control does not exist
[ERROR] /C:/Users/Macindows/IdeaProjects/thenaglecode/system-setup/src/main/java/com/thenaglecode/ServiceMuncher.java:[3,31] package com.sun.istack.internal does not exist
[ERROR] /C:/Users/Macindows/IdeaProjects/thenaglecode/system-setup/src/main/java/com/thenaglecode/TypeInfo.java:[3,31] package com.sun.istack.internal does not exist
[ERROR] /C:/Users/Macindows/IdeaProjects/thenaglecode/system-setup/src/main/java/com/thenaglecode/NumericOnlyTextFieldChangeListener.java:[3,31] package com.sun.istack.internal does not exist
[ERROR] /C:/Users/Macindows/IdeaProjects/thenaglecode/system-setup/src/main/java/com/thenaglecode/NumericOnlyTextFieldChangeListener.java:[4,26] package javafx.beans.value does not exist
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Process finished with exit code 1
Thank you for your help.
placing this in the dependencies (depending on where your jdk is) will help the dependency compile, however you should probably replace it with a variable that the user can specify in their settings.xml or maven system properties:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>javaFX</artifactId>
<version>2.2</version>
<scope>system</scope>
<systemPath>C:\Program Files\Java\jre7\lib\jfxrt.jar</systemPath>
</dependency>
see Maven project with JavaFX (with jar file in `lib`) for more details as to why
If you get these errors in a modular project with JavaFx version 17 using Maven, just try the usual things like standing on your head, walking on the ceiling, rotating the Earth in the opposite direction or even reading https://openjfx.io/openjfx-docs/ and then just switch to the version 17.0.1 or later and it should work:
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17.0.1</version>
</dependency>
This solution worked for me.
Move sample.fxml to resources folder.
This requires changing your code to getResource("/sample.fxml").
Original answer: Problem with JavaFX and maven