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>
Related
I am trying to deploy my app using heroku website, but it does not see any maven dependency like HttpServlet although I have it in my pom.xml AND it doesn't see Gson.jar although its in the lib directory. I have added webapp-runner plugin but nothing happened.
This is the error that I got. your help is appreciated. Thanks all.
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[6,21] package javax.servlet does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[7,26] package javax.servlet.http does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[8,26] package javax.servlet.http does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[9,26] package javax.servlet.http does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[11,48] package com.sun.javafx.collections.MappingChange does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[13,40] cannot find symbol
symbol: class HttpServlet
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[15,30] cannot find symbol
symbol: class HttpServletRequest
location: class hotels.HotelDealsServlet
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[15,54] cannot find symbol
symbol: class HttpServletResponse
location: class hotels.HotelDealsServlet
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[15,87] cannot find symbol
symbol: class ServletException
location: class hotels.HotelDealsServlet
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[24,64] cannot find symbol
symbol: class HttpServletRequest
location: class hotels.HotelDealsServlet
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDeals.java:[14,23] package com.google.gson does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDeals.java:[15,48] package com.sun.javafx.collections.MappingChange does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/Deals.java:[6,48] package com.sun.javafx.collections.MappingChange does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[14,9] method does not override or implement a method from a supertype
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDeals.java:[26,38] cannot find symbol
symbol: class Gson
location: class hotels.HotelDeals
[INFO] 15 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.514 s
[INFO] Finished at: 2018-03-09T16:25:19+00:00
[INFO] Final Memory: 19M/177M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project hotels: Compilation failure: Compilation failure:
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[6,21] package javax.servlet does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[7,26] package javax.servlet.http does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[8,26] package javax.servlet.http does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[9,26] package javax.servlet.http does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[11,48] package com.sun.javafx.collections.MappingChange does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[13,40] cannot find symbol
[ERROR] symbol: class HttpServlet
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[15,30] cannot find symbol
[ERROR] symbol: class HttpServletRequest
[ERROR] location: class hotels.HotelDealsServlet
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[15,54] cannot find symbol
[ERROR] symbol: class HttpServletResponse
[ERROR] location: class hotels.HotelDealsServlet
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[15,87] cannot find symbol
[ERROR] symbol: class ServletException
[ERROR] location: class hotels.HotelDealsServlet
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[24,64] cannot find symbol
[ERROR] symbol: class HttpServletRequest
[ERROR] location: class hotels.HotelDealsServlet
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDeals.java:[14,23] package com.google.gson does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDeals.java:[15,48] package com.sun.javafx.collections.MappingChange does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/Deals.java:[6,48] package com.sun.javafx.collections.MappingChange does not exist
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[14,9] method does not override or implement a method from a supertype
[ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDeals.java:[26,38] cannot find symbol
[ERROR] symbol: class Gson
[ERROR] location: class hotels.HotelDeals
[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
! ERROR: Failed to build app with Maven
We're sorry this build is failing! If you can't find the issue in application code,
please submit a ticket so we can help: https://help.heroku.com/
! Push rejected, failed to compile Java app.
! Push failed
Adding POM posted in the answer section by OP
<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.khalid.hotels</groupId>
<artifactId>hotels</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>embeddedTomcatSample Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<tomcat.version>8.5.23</tomcat.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.github.jsimone</groupId>
<artifactId>webapp-runner</artifactId>
<version>8.0.30.2</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Please use the updated POM 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.khalid.hotels</groupId>
<artifactId>hotels</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>embeddedTomcatSample Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<tomcat.version>8.5.23</tomcat.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.github.jsimone</groupId>
<artifactId>webapp-runner</artifactId>
<version>8.0.30.2</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
</dependencies>
</project>
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
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>
I am attempting to run Maven builds of a Java project, however tests are failing stating that the Player symbol cannot be founded, despite being imported.
Maven builds are failing as follows:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /var/lib/jenkins/workspace/XIVStats-Gatherer-Java/src/test/com/ffxivcensus/gatherer/PlayerTest.java:[4,31] error: cannot find symbol
[ERROR] package com.ffxivcensus.gatherer
/var/lib/jenkins/workspace/XIVStats-Gatherer-Java/src/test/com/ffxivcensus/gatherer/PlayerTest.java:[22,8] error: cannot find symbol
[ERROR] class PlayerTest
/var/lib/jenkins/workspace/XIVStats-Gatherer-Java/src/test/com/ffxivcensus/gatherer/PlayerTest.java:[22,27] error: cannot find symbol
[ERROR] class PlayerTest
/var/lib/jenkins/workspace/XIVStats-Gatherer-Java/src/test/com/ffxivcensus/gatherer/PlayerTest.java:[116,12] error: cannot find symbol
[ERROR] class PlayerTest
/var/lib/jenkins/workspace/XIVStats-Gatherer-Java/src/test/com/ffxivcensus/gatherer/PlayerTest.java:[116,28] error: cannot find symbol
[INFO] 5 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.415 s
[INFO] Finished at: 2016-01-18T15:35:38+01:00
[INFO] Final Memory: 18M/206M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (default-testCompile) on project XIVStats-Gatherer-Java: Compilation failure: Compilation failure:
[ERROR] /var/lib/jenkins/workspace/XIVStats-Gatherer-Java/src/test/com/ffxivcensus/gatherer/PlayerTest.java:[4,31] error: cannot find symbol
[ERROR] package com.ffxivcensus.gatherer
[ERROR] /var/lib/jenkins/workspace/XIVStats-Gatherer-Java/src/test/com/ffxivcensus/gatherer/PlayerTest.java:[22,8] error: cannot find symbol
[ERROR] class PlayerTest
[ERROR] /var/lib/jenkins/workspace/XIVStats-Gatherer-Java/src/test/com/ffxivcensus/gatherer/PlayerTest.java:[22,27] error: cannot find symbol
[ERROR] class PlayerTest
[ERROR] /var/lib/jenkins/workspace/XIVStats-Gatherer-Java/src/test/com/ffxivcensus/gatherer/PlayerTest.java:[116,12] error: cannot find symbol
[ERROR] class PlayerTest
[ERROR] /var/lib/jenkins/workspace/XIVStats-Gatherer-Java/src/test/com/ffxivcensus/gatherer/PlayerTest.java:[116,28] error: cannot find symbol
[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
My config is as follows:
<?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.ffxivcensus.gatherer</groupId>
<artifactId>XIVStats-Gatherer-Java</artifactId>
<version>1.0pre</version>
<name>XIVStats Lodestone Gatherer</name>
<url>https://github.com/xivstats</url>
<licenses>
<license>
<name>BSD 2-Clause License</name>
<url>https://opensource.org/licenses/BSD-2-Clause</url>
<distribution>repo</distribution>
</license>
</licenses>
<issueManagement>
<url>https://github.com/XIVStats/XIVStats-Gatherer-Java/issues</url>
<system>GitHub Issues</system>
</issueManagement>
<developers>
<developer>
<email>me#example.com</email>
<name>Peter Reid</name>
<url>https://github.com/reidweb</url>
<id>reidweb</id>
</developer>
<developer>
<email>me#example.com</email>
<name>Jonathan Price</name>
<url>https://github.com/pricetx</url>
<id>pricetx</id>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>mvnrepository.com</id>
<name>mvnrepository.com</name>
<url>http://mvnrepository.com/</url>
</repository>
</repositories>
<build>
<directory>target</directory>
<outputDirectory>target/classes</outputDirectory>
<finalName>${project.artifactId}-${project.version}</finalName>
<testOutputDirectory>target/test</testOutputDirectory>
<sourceDirectory>src/main</sourceDirectory>
<testSourceDirectory>src/test/</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<includes>
<include>src</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>com.ffxivcensus.gatherer.GathererController</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1207</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
See this github project
In your Maven-compiler-plugin definition:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<includes>
<include>src</include>
</includes>
</configuration>
</plugin>
Do not include the src folder directly. It will mess up the compilation order, Maven ends up building the test folder first, then fails on missing the main classes. Change it to this to make it work:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
</plugin>
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