Java Maven Issue - java

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)?

Related

Fatal error compiling: invalid target release: 11 during pushing to heroku

im trying to deploy my back end application to heroku
bun when I run this command
git push --force heroku-be-app splitting-staging-be:master
im getting this error
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/thoughtworks/qdox/qdox/2.0-M9/qdox-2.0-M9.jar (317 kB at 7.6 MB/s)
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 24 source files to /tmp/build_4e875976/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.593 s
[INFO] Finished at: 2020-12-21T15:28:14Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project backend: Fatal error compiling: invalid target release: 11 -> [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/MojoExecutionException
! 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
This is my pom file:
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>vs</groupId>
<artifactId>backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>backend</name>
<description>Main server voor van streek project</description>
<properties>
<java.version>15</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.4.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>5.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>jakarta.mail</artifactId>
<version>1.6.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>15</source> <!-- maven.compiler.source -->
<target>15</target> <!-- maven.compiler.target -->
</configuration>
</plugin>
</plugins>
</build>
</project>
I solved this problem by adding a new file system.properties and the content added to the file is java.runtime.version=11 (For me I am using JDK 11).
java.runtime.version=11
I would try focusing on why maven complains about invalid release 11 (Fatal error compiling: invalid target release: 11).
As seen in your pom.xml config you clearly intend to use version 15, so I would suggest to investigate why there is a problem with version 11.
Check $JAVA_HOME environment variable, system.properties file, etc.
Also try debug route suggested in official docs or a Q&A on a similar topic.
You must use the specific version of Java supported by Heroku. The following versions supported are:
Java 7 - 1.7.0_292
Java 8 - 1.8.0_282
Java 11 - 11.0.10
Java 13 - 13.0.6
Java 15 - 15.0.2
Set a java.runtime.version property of the system.properties file, create a system.properties file if one does not already exist.
java.runtime.version = SUPPORTED_VERSION
Read more in heroku-java-support
This is what I have experienced today.
I have been using jdk 1.8, and then have to install jdk 1.11.
But, after running mvnw through my shell script file dep.sh, it failed to build jar.
#!/bin/bash
MVN=$(pwd)/mvnw
echo "[1/2] Building app.jar ..."
$MVN clean package -Dmaven.test.skip=true
dep.sh calls mvnw script file with goal clan package
Error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile
(default-compile) on project dictation:
Fatal error compiling: invalid target release: 11 -> [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/MojoExecutionException
My pom.xml is configured with jdk 1.11. But it does not solve the build error.
<project ...>
<properties>
<java.version>11</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source><!-- 1.11 not working -->
<target>11</target><!-- 1.11 not working -->
</configuration>
</plugin>
</plugins>
</build>
</project>
build failure
When I installed jdk 1.8, JAVA_HOME was set to /my/jdk/1.8/dir, which is used for bundling jar.
I set JAVA_HOME to /my/jdk/1.111/dir in dep.sh, it works without error.
#!/bin/bash
JAVA_HOME="/C/Program Files/Java/jdk-11.0.9"
MVN=$(pwd)/mvnw
echo "[1/2] Building app.jar ..."
$MVN clean package -Dmaven.test.skip=true
create system.properties file and Add java.runtime.version=11

hamcrest-core: jar:1.4-atlassian-1 could not be resolved on MVN clean install on Spring Boot project

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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.mailer</groupId>
<artifactId>portfolio</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>portfolio</name>
<description>portfolio services</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.mailjet</groupId>
<artifactId>mailjet-client</artifactId>
<version>4.2.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Build logs:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< com.mailer:portfolio >------------------------
[INFO] Building portfolio 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
.
.
.
[WARNING] The POM for org.hamcrest:hamcrest-core:jar:1.4-atlassian-1 is missing, no dependency information available
.
.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project portfolio: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.22.2 or one of its dependencies could not be resolved: Failure to find org.hamcrest:hamcrest-core:jar:1.4-atlassian-1 in https://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 -> [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/PluginResolutionException
**
Any idea why am getting this error related to hamcrest jar? I added the same version of the jar in .m2/repo/... but I still get the same error. Any idea which dependency in this POM is using it internally? Do I have to change any version?
Command used to build
mvn clean install
If I run this project as Spring Boot app then the service is up but what I need is a jar out of this to host in a cloud.
This was the issue with my local repository. I had to point to a new repo location under .m2 in settings.xml.

Could not resolve dependencies for project in heroku

I am trying to deploy maven web app in the Heroku which have a dependency on some other application. When I am trying to deploy the app and getting this error. I have no clue what is going wrong in passing the dependency.
This is my pom.xml file
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.1.3.RELEASE
com.merizameen
merizameen
0.0.1-SNAPSHOT
merizameen
Frontend project for Merizameen
<properties>
<start-class>com.merizameen.MerizameenApplication</start-class>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- MY PROJECT -->
<dependency>
<groupId>com.merizameen</groupId>
<artifactId>merizameenbackend</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Error Logs---------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.953 s
[INFO] Finished at: 2019-04-16T18:29:11+00:00
[INFO] Final Memory: 20M/162M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project merizameen: Could not resolve dependencies for project com.merizameen:merizameen:jar:0.0.1-SNAPSHOT: Could not find artifact com.merizameen:merizameenbackend:jar:0.0.1-SNAPSHOT -> [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
! 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
You'll need to add com.merizameen:merizameenbackend as an un-managed dependency with a command like:
$ mvn deploy:deploy-file -Durl=file:///path/to/yourproject/repo/ -Dfile=merizameenbackend.jar -DgroupId=com.merizameen -DartifactId=merizameenbackend -Dpackaging=jar -Dversion=1.0
See this guide: https://devcenter.heroku.com/articles/local-maven-dependencies

Error in Maven when it tries to resolve dependencies, could not be resolved

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.

Maven can't find Struts2 dependencies

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

Categories