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
Related
I want to include some libraries from ping federate in my maven, I have the jars and I imported in a lib folder. I have the information in .m2 but when I run my pom with Maven says me the next:
This is my error:
[ERROR] Failed to execute goal on project identity.provider.attributevalidator: Could not resolve dependencies for project identity.provider.attributevalidator:identity.provider.attributevalidator:jar:1.0.0: The following artifacts could not be resolved: pingfederate:pf-commons:jar:9.1.1.0, pingfederate:pf-protocolengine:jar:9.1.1.0, com.unboundid.components:unboundid-ldapsdk:jar:1.0.0: Failure to find pingfederate:pf-commons:jar:9.1.1.0 in file://C:\Users\CesarMor\Documents\César\Kharon\identity.provider.plugins\Identity.Provider.Plugins\Identity.Provider.AttributeValidator/lib was cached in the local repository, resolution will not be reattempted until the update interval of pingfederate has elapsed or updates are forced -> [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/DependencyResolutionException
And here we can see pom.xml. I have written all dependencies. I don't know where is the error or where I am doing bad
<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>identity.provider.attributevalidator</groupId>
<artifactId>identity.provider.attributevalidator</artifactId>
<version>1.0.0</version>
<name>[Kharon] LDAP Attribute Validator</name>
<properties>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
<project.reporting.outputEncoding>ISO-8859-1</project.reporting.outputEncoding>
<javac.source>1.7</javac.source>
<javac.target>1.7</javac.target>
<jar.to.copy>target/${project.artifactId}</jar.to.copy>
<cobertura.version>2.1.1</cobertura.version>
</properties>
<repositories>
<repository>
<id>pingfederate</id>
<name>pingfederate</name>
<url>file://${project.basedir}/lib</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.unboundid.components</groupId>
<artifactId>json</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>pingfederate</groupId>
<artifactId>pf-commons</artifactId>
<version>9.1.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>pingfederate</groupId>
<artifactId>pf-protocolengine</artifactId>
<version>9.1.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.unboundid.components</groupId>
<artifactId>unboundid-ldapsdk</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>${javac.source}</source>
<target>${javac.target}</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
You need to actually check whether the version of identity jar is compatible with java version. If you are sure than you can try the project without using maven configuration. If all works well than try clearing maven .m2 folder as many a times, maven keeps the list of jars in cache and doesn't loads the newer jar.
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 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>
This 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.javaee7.batch</groupId>
<artifactId>batch-samples</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Batch Applications for the Java Platform (JSR-352) Example</name>
<description>Batch Applications for the Java Platform (JSR-352) Example</description>
<url>http://jboss.org/jbossas</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<distribution>repo</distribution>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
</license>
</licenses>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
<version.jboss.spec.javaee.6.0>3.0.2.Final</version.jboss.spec.javaee.6.0>
<version.war.plugin>2.1.1</version.war.plugin>
<version.compiler.plugin>2.3.1</version.compiler.plugin>
<!-- maven-compiler-plugin -->
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
<version.jboss.bom>1.0.4.Final</version.jboss.bom>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-7.0</artifactId>
<version>1.0.0.Beta2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.bom</groupId>
<artifactId>jboss-javaee-6.0-with-hibernate</artifactId>
<version>${version.jboss.bom}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Import the Batch API which is included in WildFly 8 -->
<dependency>
<groupId>org.jboss.spec.javax.batch</groupId>
<artifactId>jboss-batch-api_1.0_spec</artifactId>
<version>1.0.0.Final</version>
</dependency>
<!-- Import the CDI API -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the Common Annotations API (JSR-250) -->
<dependency>
<groupId>org.jboss.spec.javax.annotation</groupId>
<artifactId>jboss-annotations-api_1.1_spec</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the Servlet API -->
<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<!-- Set the name of the war, used as the context root when the app is deployed -->
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${version.war.plugin}</version>
<configuration>
<!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<!-- JBoss AS plugin to deploy war -->
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>${version.jboss.maven.plugin}</version>
</plugin>
<!-- Compiler plugin enforces Java 1.6 compatibility and activates
annotation processors -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version.compiler.plugin}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>`
In eclipse I am getting below errors :
1)
`Project build error: Non-resolvable import POM: Failure to transfer org.jboss.spec:jboss-javaee-7.0:pom:1.0.0.Beta2 from http://
repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.jboss.spec:jboss-javaee-7.0:pom:1.0.0.Beta2 from/to central (http:// repo.maven.apache.org/maven2): null to http://repo.maven.apache.org/maven2/org/jboss/spec/jboss-javaee-7.0/1.0.0.Beta2/jboss-javaee-7.0-1.0.0.Beta2.pom`
Same type of error I am getting for jboss-javaee-6.0-with-hibernate
2) I am also getting Project build error: 'dependencies.dependency.version' for org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar is missing.
3) Project build error: 'dependencies.dependency.version' for org.hibernate:hibernate-validator:jar is missing.
4) Project build error: 'dependencies.dependency.version' for javax.enterprise:cdi-api:jar is missing.
5) Project build error: 'dependencies.dependency.version' for org.jboss.spec.javax.annotation:jboss-annotations-api_1.1_spec:jar is missing.
6) Project build error: 'dependencies.dependency.version' for org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:jar is missing.
7)
`Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (execution:
default-compile, phase: compile)
- CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.1 or one of its dependencies
could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.1: ArtifactResolutionException:
Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.1 from http://repo.maven.apache.org/maven2 was cached in the local
repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer
artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.1 from/to central (http://repo.maven.apache.org/maven2): null to http://
repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.1/maven-compiler-plugin-2.3.1.pom
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.1:testCompile (execution:
default-testCompile, phase: test-compile)`
Please suggest.
Complete Error:
`[INFO] Scanning for projects...
Downloading: http://repo.maven.apache.org/maven2/org/jboss/spec/jboss-javaee-7.0
/1.0.0.Beta2/jboss-javaee-7.0-1.0.0.Beta2.pom
Downloading: http://repo.maven.apache.org/maven2/org/jboss/bom/jboss-javaee-6.0-
with-hibernate/1.0.4.Final/jboss-javaee-6.0-with-hibernate-1.0.4.Final.pom
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.javaee7.batch:batch-samples:1.0-SNAPSHOT (D:\Projects\
SID\POC\chunk-csv-database\chunk-csv-database\pom.xml) has 7 errors
[ERROR] Non-resolvable import POM: Could not transfer artifact org.jboss.spe
c:jboss-javaee-7.0:pom:1.0.0.Beta2 from/to central (http://repo.maven.apache.org
/maven2): repo.maven.apache.org # line 31, column 22: Unknown host repo.maven.ap
ache.org -> [Help 2]
[ERROR] Non-resolvable import POM: Could not transfer artifact org.jboss.bom
:jboss-javaee-6.0-with-hibernate:pom:1.0.4.Final from/to central (http://repo.ma
ven.apache.org/maven2): repo.maven.apache.org # line 38, column 22: Unknown host
repo.maven.apache.org -> [Help 2]
[ERROR] 'dependencies.dependency.version' for org.hibernate.javax.persistenc
e:hibernate-jpa-2.0-api:jar is missing. # line 48, column 19
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-valida
tor:jar is missing. # line 53, column 19
[ERROR] 'dependencies.dependency.version' for javax.enterprise:cdi-api:jar i
s missing. # line 71, column 19
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.annotatio
n:jboss-annotations-api_1.1_spec:jar is missing. # line 77, column 19
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.servlet:j
boss-servlet-api_3.0_spec:jar is missing. # line 83, column 19
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildin
gException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableMo
delException`
From the stacktrace:
Unknown host repo.maven.apache.org
Regardless of the other comments, if you can't resolve the central repo you're not going to be able to download the dependencies.
Are you able to ping this from the command line (or at least get an IP for it)?
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