mvn dependency:tree, multi-module and ${revision} - maven

Does dependency:tree understand ${revision}?
I have a multi-module project X:
<groupId>org.X</groupId>
<artifactId>X-parent</artifactId>
<version>${revision}</version>
<properties>
<revision>8.0.0-SNAPSHOT</revision>
</properties>
<modules>
<module>X-A</module>
:
It is installed to my local .m2 (and only there).
I have a project Y which depends on X-A, revision 8.0.0-SNAPSHOT
Project Y's pom also includes:
<repositories>
<repository>
<id>rescarta</id>
<url>http://software.rescarta.org/nexus/content/groups/public/</url>
</repository>
</repositories>
When I run mvn dependency:tree on project Y, it complains:
$ mvn -U dependency:tree
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/3.0.1/maven-dependency-plugin-3.0.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/3.0.1/maven-dependency-plugin-3.0.1.pom (14 kB at 7.0 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/3.0.1/maven-dependency-plugin-3.0.1.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/3.0.1/maven-dependency-plugin-3.0.1.jar (164 kB at 186 kB/s)
[INFO]
[INFO] -------------------< com.y:Y >-------------------
[INFO] Building Y 8.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from rescarta: http://software.rescarta.org/nexus/content/groups/public/org/x/X-A/8.0.0-SNAPSHOT/maven-metadata.xml
Downloading from rescarta: http://software.rescarta.org/nexus/content/groups/public/org/x/X-parent/$%7Brevision%7D/X-parent-$%7Brevision%7D.pom
Downloading from central: https://repo.maven.apache.org/maven2/org/x/X-parent/$%7Brevision%7D/X-parent-$%7Brevision%7D.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.681 s
[INFO] Finished at: 2019-04-08T06:45:53+10:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project Y: Could not resolve dependencies for project com.y:Y:jar:8.0.0-SNAPSHOT: Failed to collect dependencies at org.x:X-A:jar:8.0.0-SNAPSHOT: Failed to read artifact descriptor for org.x:X-A:jar:8.0.0-SNAPSHOT: Could not find artifact org.x:X-parent:pom:${revision} in rescarta (http://software.rescarta.org/nexus/content/groups/public/) -> [Help 1]
Notice it is trying to download org.x:X-parent:pom:${revision}, not org.x:X-parent:pom:8.0.0-SNAPSHOT
Does dependency:tree not know how to resolve ${revision}?

The flatten-maven-plugin as explained at https://stackoverflow.com/a/52173650/1031689 seems to be an effective workaround.

Related

Maven: local dependency installed not found

This is my project structure:
$ ls
pom.xml
README.md
rep-digital-api
rep-digital-common
So, rep-digital-api has rep-digital-common as dependency.
I first install succesfully rep-digital-common:
mvn -pl rep-digital-common clean package install
The problem appears when I'm trying to tun my rep-digital-api spring-boot service:
mvn clean package -pl rep-digital-api
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building rep-digital-api 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.417 s
[INFO] Finished at: 2018-08-13T15:35:28+02:00
[INFO] Final Memory: 28M/68M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project rep-digital-api: Could not resolve dependencies for project net.gencat.transversal.repositori.digital:rep-digital-api:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at net.gencat.transversal.repositori.digital:rep-digital-common:jar:0.0.1-SNAPSHOT: Failed to read artifact descriptor for net.gencat.transversal.repositori.digital:rep-digital-common:jar:0.0.1-SNAPSHOT: Could not find artifact net.gencat.transversal.repositori.digital:rep-digital:pom:0.0.1-SNAPSHOT -> [Help 1]
EDIT
Parent pom.xml fragment:
<modules>
<module>rep-digital-common</module>
<module>rep-digital-api</module>
</modules>
I've took a look on my local repositori. The package seems to be installed:
$ ls ~/.m2/repository/net/gencat/transversal/repositori/digital/rep-digital-common/
0.0.1-SNAPSHOT maven-metadata-local.xml
My ~/.m2/settings.xml fragment:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
</settings>
EDIT 2
Parent pom.xml is:
<groupId>net.gencat.transversal.repositori.digital</groupId>
<artifactId>rep-digital</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
I've realized mvn is telling me that parent's pom.xml can't be resolved:
Could not find artifact net.gencat.transversal.repositori.digital:rep-digital:pom:0.0.1-SNAPSHOT

Downloading ear file from nexus using maven dependency plugin get goal

I am using the maven dependency plugin get goal to download an artefact from nexus. I can use it to download jar as per below
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -DrepoUrl=http://nexus.url/nexus/content/groups/public-all/ -Dartifact=groupId:artifactId:version:jar -Dtransitive=false -Ddestination=/my/path
To download a war I can use
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -DrepoUrl=http://nexus.url/nexus/content/groups/public-all/ -Dartifact=groupId:artifactId:version:war -Dtransitive=false -Ddestination=/my/path
I am however failing to download an ear using the following
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -DrepoUrl=http://nexus.url/nexus/content/groups/public-all/ -Dartifact=groupId:artifactId:version:ear -Dtransitive=false -Ddestination=/my/path
The output of the above command is as per below
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:get (default-cli) # standalone-pom ---
[INFO] Resolving groupId:artifactId:ear:version
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.797 s
[INFO] Finished at: 2017-10-20T13:31:02+02:00
[INFO] Final Memory: 7M/19M
[INFO] ------------------------------------------------------------------------
I have confirmed that the ear is indeed present in Nexus. The above command runs successfully but the ear is not actually downloaded.
What is wrong with the above command to download the ear? How can I download an ear file from Nexus using the mvn command?
Do note that I have replaced the actual groupId, artifactId and versions in the code above with their respective words.

Can't compile PrimeFaces demo

I downloaded the PF demo from git at: https://github.com/primefaces/showcase
And run mvn package, but received the following message:
martin#MyUbuntu:~/study/PrimeFaces/showcase$ mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building primefaces-showcase 6.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repository.primefaces.org/org/primefaces/themes/all-themes/1.0.10/all-themes-1.0.10.pom
Downloaded: http://repository.primefaces.org/org/primefaces/themes/all-themes/1.0.10/all-themes-1.0.10.pom (10 KB at 8.7 KB/sec)
Downloading: http://repository.primefaces.org/org/primefaces/themes/themes-project/1.0.10/themes-project-1.0.10.pom
Downloaded: http://repository.primefaces.org/org/primefaces/themes/themes-project/1.0.10/themes-project-1.0.10.pom (4 KB at 8.1 KB/sec)
Downloading: http://repository.primefaces.org/org/primefaces/primefaces/6.0-SNAPSHOT/maven-metadata.xml
Downloading: http://repository.primefaces.org/org/primefaces/primefaces/6.0-SNAPSHOT/primefaces-6.0-SNAPSHOT.pom
[WARNING] The POM for org.primefaces:primefaces:jar:6.0-SNAPSHOT is missing, no dependency information available
Downloading: http://repository.primefaces.org/org/primefaces/themes/all-themes/1.0.10/all-themes-1.0.10.jar
Downloading: http://repository.primefaces.org/org/primefaces/primefaces/6.0-SNAPSHOT/primefaces-6.0-SNAPSHOT.jar
Downloaded: http://repository.primefaces.org/org/primefaces/themes/all-themes/1.0.10/all-themes-1.0.10.jar (1335 KB at 72.0 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.563 s
[INFO] Finished at: 2016-03-08T16:30:14-08:00
[INFO] Final Memory: 11M/153M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project showcase: Could not resolve dependencies for project org.primefaces:showcase:war:6.0-SNAPSHOT: Could not find artifact org.primefaces:primefaces:jar:6.0-SNAPSHOT in prime-repo (http://repository.primefaces.org) -> [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
In your pom.xml file under <id>dev</id> fill in the correct version you find at https://repository.primefaces.org/org/primefaces/primefaces/
For the latest build as of today:
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.1.RC2</version>
</dependency>
The pom of the showcase references to an primefaces 6.0 snapshot jar on the primefaces sftp server.
As far as i can see there is no way to get this jar. I would recomend you to use the prebuild showcase war file and put it on a application server showcase download

while running maven project i am getting this error

while running this command
mvn clean package liferay:depoy
in maven project i am getting this error.
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metada
ta.xml
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven
-metadata.xml
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
metadata.xml (13 KB at 6.9 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadat
a.xml (20 KB at 9.6 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.313 s
[INFO] Finished at: 2015-07-10T14:11:49-04:00
[INFO] Final Memory: 15M/105M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'liferay' in the current project and in the p
lugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the re
positories [local (C:\Users\Nokia_Admin\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
Whatever plugin you have developed( portlets, themes, layout templates, hooks or Ext) you need to navigate to that specific plugin and then fire your command to deploy your plugin.
mvn clean package liferay:depoy
It is mentioned in your error that maven is not able to find the plugin as your path mentioned is wroong.
Try to include repositories to be downloaded by including this stuff on your pom:
<profiles>
<profile>
<id>Liferay-v6.2-CE-(Tomcat-7)</id>
<properties>
<liferay.version>Your_Liferay-Version</liferay.version>
<liferay.maven.plugin.version>6.2.5</liferay.maven.plugin.version>
<liferay.auto.deploy.dir>/opt/liferay-portal-6.2-ce-ga4/deploy</liferay.auto.deploy.dir>
<liferay.app.server.deploy.dir>/opt/liferay-portal-6.2-ce-ga4/tomcat-7.0.42/webapps</liferay.app.server.deploy.dir>
<liferay.app.server.lib.global.dir>/opt/liferay-portal-6.2-ce-ga4/tomcat-7.0.42/lib/ext</liferay.app.server.lib.global.dir>
<liferay.app.server.portal.dir>/opt/liferay-portal-6.2-ce-ga4/tomcat-7.0.42/webapps/ROOT</liferay.app.server.portal.dir>
</properties>
</profile>
</profiles>

tomcat 7 maven plugin snapshot repository issue?

I would like to have tomcat 7 maven plugin, and followed the instruction from [the plugin site][1].
What happened is that it seems to be able to find the tomcat 6.0.29, but not the version 7.
I know that because when i tried tomcat:run, the one that was started is the 6.0.29 version.
As far as i know, the plugin for t7 is still in development, thus the snapshot version, and i assumed that i'd need to provide the repo for the snapshot plugin, and i placed
<pluginRepository>
<id>tomcat snapshot</id>
<name>tomcat snapshot</name>
<url>http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/</url>
</pluginRepository>
but it doesnt seem to have any changes with my tomcat:run -U (to update the snapshot), still 6.x version running. Here's the output of my mvn tomcat:info -U :
C:\Users\albert\workspace\BasicSetup>mvn tomcat:info -U
[INFO] Scanning for projects...
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/org/apache
/tomcat/maven/tomcat7-maven-plugin/2.0-SNAPSHOT/maven-metadata.xml
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/org/apache
/tomcat/maven/tomcat7-maven-plugin/2.0-SNAPSHOT/maven-metadata.xml
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/org/apache
/tomcat/maven/tomcat7-maven-plugin/2.0-SNAPSHOT/tomcat7-maven-plugin-2.0-SNAPSHOT.pom
[WARNING] The POM for org.apache.tomcat.maven:tomcat7-maven-plugin:jar:2.0-SNAPSHOT is missing, no d
ependency information available
[WARNING] Failed to retrieve plugin descriptor for org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-
SNAPSHOT: Plugin org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-SNAPSHOT or one of its dependencie
s could not be resolved: Failed to read artifact descriptor for org.apache.tomcat.maven:tomcat7-mave
n-plugin:jar:2.0-SNAPSHOT
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: http://repo1.maven.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/org/codeha
us/mojo/maven-metadata.xml
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/org/apache
/maven/plugins/maven-metadata.xml
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-metadata.xml (11 KB at 6.1
KB/sec)
Downloaded: http://repo1.maven.org/maven2/org/codehaus/mojo/maven-metadata.xml (18 KB at 10.7 KB/sec
)
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/org/codeha
us/mojo/tomcat-maven-plugin/maven-metadata.xml
Downloading: http://repo1.maven.org/maven2/org/codehaus/mojo/tomcat-maven-plugin/maven-metadata.xml
Downloaded: http://repo1.maven.org/maven2/org/codehaus/mojo/tomcat-maven-plugin/maven-metadata.xml (
439 B at 0.1 KB/sec)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building BasicSetup Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/org/apache
/tomcat/maven/tomcat7-maven-plugin/2.0-SNAPSHOT/tomcat7-maven-plugin-2.0-SNAPSHOT.pom
[WARNING] The POM for org.apache.tomcat.maven:tomcat7-maven-plugin:jar:2.0-SNAPSHOT is missing, no d
ependency information available
[WARNING] Failed to retrieve plugin descriptor for org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-
SNAPSHOT: Plugin org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-SNAPSHOT or one of its dependencie
s could not be resolved: Failed to read artifact descriptor for org.apache.tomcat.maven:tomcat7-mave
n-plugin:jar:2.0-SNAPSHOT
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/org/codeha
us/mojo/maven-metadata.xml
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/org/apache
/maven/plugins/maven-metadata.xml
Downloading: http://repo1.maven.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-metadata.xml (11 KB at 6.0
KB/sec)
Downloaded: http://repo1.maven.org/maven2/org/codehaus/mojo/maven-metadata.xml (18 KB at 4.4 KB/sec)
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/org/codeha
us/mojo/tomcat-maven-plugin/maven-metadata.xml
Downloading: http://repo1.maven.org/maven2/org/codehaus/mojo/tomcat-maven-plugin/maven-metadata.xml
Downloaded: http://repo1.maven.org/maven2/org/codehaus/mojo/tomcat-maven-plugin/maven-metadata.xml (
439 B at 0.2 KB/sec)
[INFO]
[INFO] --- tomcat-maven-plugin:1.1:info (default-cli) # BasicSetup ---
[INFO] Listing server information at http://localhost:8080/manager
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 36.348s
[INFO] Finished at: Wed Oct 26 14:28:40 ICT 2011
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:info (default-cli) on proje
ct BasicSetup: Cannot invoke Tomcat manager: Connection refused: connect -> [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 arti
cles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Any help would be appreciated ..
Try this:
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshots</name>
<url>http://people.apache.org/repo/m2-snapshot-repository</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
http://tomcat.apache.org/maven-plugin-2.0-SNAPSHOT/snapshot-test.html

Resources