I have a maven project setup.
In my maven POM file, it is defined as below:
<?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>
<parent>
<groupId>com.myProject</groupId>
<artifactId>basePOM</artifactId>
<version>1.0</version>
<relativePath>../../../shared/common/pom.xml</relativePath>
</parent>
<groupId>com.myProject.services</groupId>
<artifactId>orderservice</artifactId>
<version>developer</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.3</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!--Internal dependencies-->
<dependency>
<groupId>com.myProject.shared</groupId>
<artifactId>model</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-spring</artifactId>
</dependency>
</dependencies>
</project>
I have a parent POM which defines some common bits:
<?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>
<name>Base POM</name>
<groupId>com.myProject</groupId>
<artifactId>basePOM</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.myProject.shared</groupId>
<artifactId>model</artifactId>
<version>developer</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>1.2.GA</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-spring</artifactId>
<version>1.2.GA</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
When I run
mvn clean install
The resteasy-jaxrs and resteasy-spring are downloaded to my local repository without problem.
However, it then produces an error said:
**[ERROR] Failed to execute goal on project orderservice: Could not resolve dependencies for
project com.mxyy.services:orderservice:war:developer: Failed to collect dependencies for
[com.mxyy.shared:model:jar:developer (compile), org.jboss.resteasy:resteasy-jaxrs:jar:1.2.
GA (compile), org.jboss.resteasy:resteasy-spring:jar:1.2.GA (compile), org.testng:testng:j
ar:jdk15:5.8 (test)]: Failed to read artifact descriptor for com.mxyy.shared:model:jar:dev
eloper: Failure to find com.mxyy:basePOM:pom:1.0 in http://repo.maven.apache.org/maven2 wa
s cached in the local repository, resolution will not be reattempted until the update inte
rval of central has elapsed or updates are forced -> [Help 1]**
It looks like the project cannot pickup the dependencies already in my local repository.
Can someone let me know how I can solve this problem?
Many thanks
More Info:
I have temporarily removed the dependency com.myProject.shared. Now the error message becomes:
[ERROR] Failed to execute goal on project orderservice: Could not resolve dependencies for project com.mxyy.services:orderservice:war:developer: Faile
d to collect dependencies for [org.jboss.resteasy:resteasy-jaxrs:jar:1.2.GA (compile), org.jboss.resteasy:resteasy-spring:jar:1.2.GA (compile)]: Faile
d to read artifact descriptor for org.scannotation:scannotation:jar:1.0.2: Could not transfer artifact org.scannotation:scannotation:pom:1.0.2 from/to
jboss (http://repository.jboss.org/maven2): Access denied to: http://repository.jboss.org/maven2/org/scannotation/scannotation/1.0.2/scannotation-1.0
.2.pom, ReasonPhrase:Forbidden. -> [Help 1]
Well, looks like the access is forbidden.
You need to use the right path to JBoss repository: https://repository.jboss.org/nexus/content/groups/public-jboss/
Here is the artifact you need:
https://repository.jboss.org/nexus/content/groups/public-jboss/org/scannotation/scannotation/
So, mention in your POM:
<repository>
<id>JBoss</id>
<name>JBoss</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
</repository>
in repositories list
mvn clean install your model project first. That will install its artifacts into your local repo where your target build can find them.
Edit:
If this still does not help, use the -X switch to display more error/debug information:
mvn -X clean install
Just looking at your error output (and i assume you didn't type it in manually), it seems you have mistyped the group id from myProject to mxProject.
double check dependency declaration (artifactId and groupId), it can be just a typo ;)
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 try to create a maven web project.
I follow this guide
The problem is that when I create the project, it has this error. Thi is my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.crud</groupId>
<artifactId>CRUD</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>CRUD Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
</dependency>
</dependencies>
</project>
THIS IS the build error:
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (https://repo.maven.apache.org/maven2): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty -> [Help 1]
Anyone can help me to resolve this?
I assume you are using JDK 7...if so you have to check your JDK 7 options cause a month ago Maven Central does not support anymore TLS v1.X you have to configure your build by using:
mvn -Dhttps.protocols=TLSv1.2 <goals>
More details can be found on the documentation.
Apart from the above I recommend to try the build on plain command line and not inside Eclipse...
I am developing a spring boot project which has few modules. I have on entry point module which has main class, the other module dependencis i have added in entry point module pom.xml. When i give command mvn clean install it throws an error saying `
Failed to execute goal on project api: Could not resolve dependencies
for project com.nikesh:api:jar:1.0.0: The following artifacts could
not be resolved: com.nikesh:lib:jar:1.0.0, com.nikesh:repo:jar:1.0.0,
com.nikesh:entity:jar:1.0.0, com.nikesh:dto:jar:1.0.0,
com.nikesh:service:jar:1.0.0, com.nikesh:common:jar:1.0.0: Failure to
find com.nikesh:lib:jar:1.0.0 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
-`
This is my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.nikesh</groupId>
<artifactId>api</artifactId>
<version>1.0.0</version>
<description>api module</description>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
<start-class>com.nikesh.api.MultiModuleApp</start-class>
</properties>
<dependencies>
<dependency>
<groupId>com.nikesh</groupId>
<artifactId>lib</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.nikesh</groupId>
<artifactId>repo</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.nikesh</groupId>
<artifactId>entity</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.nikesh</groupId>
<artifactId>dto</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.nikesh</groupId>
<artifactId>service</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.nikesh</groupId>
<artifactId>common</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Please help me out resolving this issue.
You need to make sure that all sub modules are built in proper order before the main module build.
Guide to Working with Multiple Modules
The Reactor
The mechanism in Maven that handles multi-module projects is referred to as the reactor. This part of the Maven core does the following:
Collects all the available modules to build
Sorts the projects into the correct build order
Builds the selected projects in order
Because modules within a multi-module build can depend on each other, it is important that The reactor sorts all the projects in a way that guarantees any project is built before it is required.
The following relationships are honoured when sorting projects:
a project dependency on another module in the build
a plugin declaration where the plugin is another modules in the build
a plugin dependency on another module in the build
a build extension declaration on another module in the build
the order declared in the element (if no other rule
applies)
Note that only "instantiated" references are used - dependencyManagement and pluginManagement elements will not cause a change to the reactor sort order
for more info. You can refer this link for a sample multi module maven project.
Hi Please help me to resolve this below issue I am new to java, I having POM.xml in my project which showing below error even after I am done the below mentioned steps.
Steps I tried from my side is
Deleted all cache file from maven repository
Updated project via Maven, still I am not able to resolve this issue
Error message is like
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven- compiler-plugin:2.3.2:testCompile (execution: default-testCompile, phase: test-compile)
My POM.xml is
<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>csp</groupId>
<artifactId>CustomerFileTransfer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>CustomerFileTransferApp</name>
<dependencies>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
</dependencies>
</project>
Please let me know what am missing to do..
Does anyone have an idea how to resolve this Maven error? I get the following when I attempt to update my project's snapshots:
Build errors for my-projects-name;
org.apache.maven.lifecycle.LifecycleExecutionException:
Internal error in the plugin manager
executing goal
'org.apache.maven.plugins:maven-dependency-plugin:2.0:unpack':
Mojo execution failed.
And then when I try running "mvn install":
[INFO] [assembly:single {execution:default}] [INFO]
---------------------------------------------------------
[ERROR] BUILD ERROR [INFO]
---------------------------------------------------------
[INFO] Error reading assemblies: No assembly descriptors found.
I'm running Maven 2.1.0. Can anyone shed some light as to why it's balking at me? Other team members are able to perform the above actions with the exact same copy of the code from SVN.
Thanks!
Edit: Here's the POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.company.group</groupId>
<artifactId>the-project-parent</artifactId>
<version>1.0</version>
</parent>
<groupId>com.company.group.project</groupId>
<artifactId>project-root</artifactId>
<packaging>pom</packaging>
<name>Project Name</name>
<version>1.0.2-SNAPSHOT</version>
<description>This artifact contains the common settings for the Project.</description>
<url>http://maven.dev.companyName.com/sites/projectGroup/project</url>
<scm>
<connection>scm:svn:https://sourceforge.companyname.com/svn/repos/group/tags/projGroup/my-project-name</connection>
<developerConnection>scm:svn:https://sourceforge.companyname.com/svn/repos/group/tags/projGroup/my-project-name</developerConnection>
</scm>
<modules>
<module>module-1</module>
<module>module-2</module>
<module>module-3</module>
<module>module-4</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>net.sourceforge.jtds.jdbc</groupId>
<artifactId>jtds</artifactId>
<version>1.2.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.unitils</groupId>
<artifactId>unitils</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>2.3</version>
<scope>test</scope>
</dependency>
<!-- I cut most dependencies for brevity -->
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-5</version>
<inherited>false</inherited>
<configuration>
<preparationGoals>clean install</preparationGoals>
<tagBase>https://sourceforge.companyname.com/svn/repos/projects/tags/projGroup/my-project-name</tagBase>
</configuration>
</plugin>
</plugins>
</build>
</project>
You have no assembly plugin configuration shown in the pom you pasted. Perhaps it's in the parent? If there's no config then the assembly plugin will complain because you haven't configured it with a descriptor that tells it what to do. run mvn help:effective-pom and then paste those results (make sure to scrub any passwords) so I can see your full pom after inheritence.
I finally got it to run the install goal by downgrading Maven to 2.0.9.
EDIT:
I tried executing mvn clean install and mvn clean install assembly:assembly using Maven 2.1.0 and it duplicated the above error: > "No Assembly descriptors found."
It still works with Maven 2.0.9. I'm wholly convinced that at minimum something has changed between versions which is causing this this discrepancy...
EDIT:
From what I've been able to find out, it appears there's likely some kind of version conflict between Maven 2.1.0 and the version of this plugin we use:
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-5</version>