The POM for <name> is invalid, transitive dependencies (if any) will not be available
JavaMavenJava Problem Overview
This question is outdated and no longer relevant. I have since moved to Gradle for my project build and can no longer verify that answers do or do not work.
I've run into a few issues with Maven. Let me first describe my project setup:
Framework
| -- Apache Commons Math 3.0
| -- Bouncy Castle 1.5
| -- etc.. (lots more)
|________
| Client
| | -- GUI libraries
| | -- etc.
|
|________
Server
| -- Server Libraries
| -- etc.
So essentially I have a framework that contains most dependancies and then two projects, "Server" and "Client" that contain their own BUT also the framework as a dependancy (being a module of Framework.). I installed the Framework project into my local repository and both my projects can see the Framework-Native code (aka my own logic). HOWEVER they don't seem to be able to use any of the dependancies of the Framework Project. When trying to build either of the "child"-projects I get this:
Invalid POM for de.r2soft.empires.framework:Framework:jar:Alpha-1.2,
transitive dependencies (if any) will not be available,
enable debug logging for more details
I've tried to find the reason behind this (or better yet a solution) but haven't found anything that fixed my issues. Hope someone here can help. My maven version seems to be 3.2.1 (that's what -version tells me anyways)
Here are my framework-pom.xml and the client-pom.xml on pastebin:
Framework: http://pastebin.com/cceZECaT
Client: http://pastebin.com/1Cuxve5F
Help is appreciated.
Java Solutions
Solution 1 - Java
One reason for this is when you rely on a project for which the parent pom is outdated. This often happens if you are updating the parent pom without installing/deploying it.
To see if this is the case, just run with mvn dependency:tree -X
and search for the exact error. It will mention it misses things you know are in the parent pom, not in the artifact you depend on (e.g. a jar version).
The fix is pretty simple: install the parent pom using mvn install -N
and re-try
Solution 2 - Java
I had a similar error, In my case remove all related artifacts from the local repository was the workaround...
Solution 3 - Java
Remove repository folder inside .m2 and launch mvn clean install.
Keep us informed by the result and Good luck
Solution 4 - Java
Assuming that the client and server projects poms are invalid because of unsatisfied mvn -N clean install
The -N option tells maven to only install the root pom in the local repo and to skip the child modules. Now cd to your child project and rerun your install command in your client or server module. The client or server build should now find the parent pom with the properties that it needs in the local repo.
You can get the same effect by making an explicit file path reference using the relativePath tag in your child pom's parent tag:
<parent>
<relativePath>../my-parent</relativePath>
</parent>
Solution 5 - Java
I have the same kind of issue and I may have the answer.
I have a top level project MyProject
and Module1
and Module2
.
Module2
depends on Module1
and the entry is listed as a (default) dependency.
MyProject
<modules>
Module1
Module2
</modules>
mvn dependency:tree
from the folder of MyProject
is OK: module2 depends on module1
MyProject
---
com.acme:Module1:version
---
com.acme:Module2:version
+com.acme:Module1:version
The problem is if I run mvn dependency:tree
inside the Module2
folder.
I then get the error message:
The POM for com.acme:Module2:version is invalid,
transitive dependencies (if any) will not be available
After a few investigations I have discovered that the pom file created/copied by the install part of the build as m2/com/acme/myproject/Module1/version/Module1-version.pom
is the original pom file.
This one uses variables for versions as (duplicated in many other modules not listed here) or a system path (no choice to have a system dependency). These variables are defined in the parent POM file.
If I replace all the ${}
in the module pom file by their values then everything is fine.
Basically when building the whole thing, the values of the variables are available to all the dependent modules as this is the same process. When you build an individual module the variables defined in the parent POM are not available.
Your own framework pom file contains a variable for the systempath of net.sf.javaml
.
Hardcode the variable or find another solution like a bill of material.
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
Solution 6 - Java
The the Framework artifact available in your local repository before running an install
on the client project because there is no coupling between the two projects (the client artifact is not a module
of your Framework project).
So to solve the issue you should run mvn install
on your Framework project so the packaged jar is copied to your local repository. Then it is up to maven to discover and find it when you run some maven phase on the client project.
To have your artifacts shared among your organization you should deploy your artifacts (upload) to a nexus hosting mirror.
Solution 7 - Java
I had the same issue. I am managing all the modules that were referenced by the project that i was trying to build. And the problem turned out that i had to do "mvn deploy" on all the parent projects of the module that was showing this error when using in another modules pom.xml. Here is the whole explanation http://programtalk.com/java/i-used-to-get-this-maven-error-all-time/
Solution 8 - Java
You must to send output to log file with this command:
mvn clean install --log-file C:\XXXX\Maven\log.txt
open log.txt and analize what dependencies are not found or pom.xml are in not valid state
remove pom's that are not valid and re run mvn clean install
that is all.
Solution 9 - Java
In my case maven corrupted one of transitive dependency pom (double content), so I just removed it in my m2 folder. -X key helped me to find the certain broken pom.
Solution 10 - Java
For me the pom.xml contents load from a repository to the .m2 folder and the contents of the file when I opened was HTML content which was the reason why I was getting this WARNING message because the site was moved to a different repository location,
[WARNING] The POM for GROUPID:ARTIFACTID:PACKAGIN:VERSION is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
So I modified the pom.xml contents to,
<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</groupId>
<artifactId>ARTIFACTID</artifactId>
<version>VERSION</version>
<packaging>PACKAGIN</packaging>
</project>
Now if I run mvn clean install on the module which had the above dependency the warning din't show. So check the contents of the pom.xml.