aether

Get all the dependencies of a MavenProject (including transitive ones) using Aether

末鹿安然 提交于 2019-12-05 07:13:55
问题 How can you get all the dependencies of a MavenProject (including transitive ones) using Aether? I have seen numerous examples where you specify the gav and it resolves the artifact and all it's dependencies. This is all fine. However, if your plugin is supposed to be invoked from the same project whose dependencies you're trying to resolve, this does not seem to work (or perhaps I am doing it wrong). Could somebody please give me a working example of how to do it? I have tried the example

How to get local repository location from Maven 3.0 plugin?

时光怂恿深爱的人放手 提交于 2019-12-05 03:24:09
How to get local repository location (URI) from within Maven 3.x plugin? Use Aether as described in this blog post . /** * The current repository/network configuration of Maven. * * @parameter default-value="${repositorySystemSession}" * @readonly */ private RepositorySystemSession repoSession; now get the local Repo through RepositorySystemSession.getLocalRepository() : LocalRepository localRepo = repoSession.getLocalRepository(); LocalRepository has a getBasedir() method, which is probably what you want. This one worked for me in Maven v3.6.0: @Parameter(defaultValue = "${localRepository}",

How to programmatically build the effective model of a pom file?

那年仲夏 提交于 2019-12-05 02:57:19
问题 I would create programmatically the effective model from a pom file to get all inherited attributes in the pom model instance. I would analyze some attributes of a pom - but I need for it all attributes - incl. inhertied. What have I to do? I have tried Sonatype Aether but I did not find a example. 回答1: Check out this Gist https://gist.github.com/reiz/6203767. It shows a method which builds a MavenProject inside of a maven plugin. On the MavenProject you can call methods like project

Retrieving Maven Artifact from Repository using Maven Java API

ε祈祈猫儿з 提交于 2019-12-04 01:13:31
问题 If I have a Maven Artifact information (GroupId, ArtifactId, Version) how can I programmatically (using Java) retrieve that Artifact from my local repository? Specifically, I need to be able to connect to the Maven Repository and create/retrieve a org.apache.maven.artifact.Artifact so I can retrieve the file associated with the Artifact. I have looked into m2e source code, but the MavenImpl.java (which provides Artifact resolution) is way more complex than what I need and it is difficult to

How to programmatically build the effective model of a pom file?

旧时模样 提交于 2019-12-03 17:17:05
I would create programmatically the effective model from a pom file to get all inherited attributes in the pom model instance. I would analyze some attributes of a pom - but I need for it all attributes - incl. inhertied. What have I to do? I have tried Sonatype Aether but I did not find a example. Check out this Gist https://gist.github.com/reiz/6203767 . It shows a method which builds a MavenProject inside of a maven plugin. On the MavenProject you can call methods like project.getDependencies() and so on. You could just run mvn help:effective-pom to get the pom that maven is actually using,

Can a maven mojo relying on Aether be compatible with Maven 3.0.x and 3.1.x?

我的未来我决定 提交于 2019-12-03 13:05:09
The 3.1.0 release of Maven relies on Eclipse Aether (org.eclipse.aether) instead of Sonatype Aether (org.sonatype.aether). This seems to break compatibility for plugins relying on Sonatype aether : try running such plugins and you'll run into : java.lang.NoClassDefFoundError: org/sonatype/aether/* Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.* As documented in https://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound Now, is it possible to make a mojo relying on aether classes (such as org.sonatype.aether.RepositorySystemSession) run both with Maven 3.0.x and

Programmatically resolving Maven dependencies outside of a plugin - get RepositorySystemSession and RepositorySystem

浪子不回头ぞ 提交于 2019-12-03 06:06:59
问题 Maybe this is going to be a larger task than I had originally thought, but regardless, I'm trying to load a MavenProject from a file and then resolve its dependencies. I've got the code for both bits but I'm missing some object references that I need; specifically I need to get instances of RepositorySystemSession and RepositorySystem . Any tips? Note: I have tagged this question with maven-plugin, but this is not a Maven plugin. I am happy to mandate Maven 3 (think I already have anyway..)

Programmatically resolving Maven dependencies outside of a plugin - get RepositorySystemSession and RepositorySystem

与世无争的帅哥 提交于 2019-12-02 19:32:19
Maybe this is going to be a larger task than I had originally thought, but regardless, I'm trying to load a MavenProject from a file and then resolve its dependencies. I've got the code for both bits but I'm missing some object references that I need; specifically I need to get instances of RepositorySystemSession and RepositorySystem . Any tips? Note: I have tagged this question with maven-plugin , but this is not a Maven plugin. I am happy to mandate Maven 3 (think I already have anyway..) Here's the code I have so far: Constructing the MavenProject : public static MavenProject loadProject

Retrieving Maven Artifact from Repository using Maven Java API

风流意气都作罢 提交于 2019-12-01 04:46:13
If I have a Maven Artifact information (GroupId, ArtifactId, Version) how can I programmatically (using Java) retrieve that Artifact from my local repository? Specifically, I need to be able to connect to the Maven Repository and create/retrieve a org.apache.maven.artifact.Artifact so I can retrieve the file associated with the Artifact. I have looked into m2e source code, but the MavenImpl.java (which provides Artifact resolution) is way more complex than what I need and it is difficult to understand how the connection to the repository works. Philippe Marschall You'll probably want to look

java.lang.ClassNotFoundException: org.sonatype.aether.version.InvalidVersionSpecificationException

拟墨画扇 提交于 2019-11-30 08:28:40
I am using the maven indexer to fetch the maven index from the maven central repository. Since I updated from org.sonatype.aether to org.eclipse.aether and from maven 3.0.5 to maven 3.1.0 I am getting this Exception. Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.version.InvalidVersionSpecificationException at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230) Maven