aether

Maven: get all dependencies programmatically

烈酒焚心 提交于 2020-07-28 13:17:42
问题 How can I programmatically get all dependencies of a Maven module outside a Maven execution environment? So far I have: via maven-core: Path pomPath = ...; MavenXpp3Reader reader = new MavenXpp3Reader(); try (InputStream is = Files.newInputStream(pomPath)) { Model model = reader.read(is); this.mavenProject = new MavenProject(model); } and via jcabi-aether: File localRepo = Paths.get(System.getProperty("user.home"), ".m2").toFile(); new Classpath(mavenProject, localRepo, "runtime") Is this

How to use Aether (eclipse) in Maven Plugins using API 3.1.1?

好久不见. 提交于 2020-01-13 19:05:32
问题 I am developing a new Maven plugin using API v3.1.1 because I need to upgrade to Maven 3.1.1, and need the Aether way of dealing with artifact repositories, among other things retrieving the complete list of artifact versions. I am using Eclipse Aether (0.9.0.M4), NOT Sonatype Aether. I have already read through http://wiki.eclipse.org/Aether and tried the demos http://git.eclipse.org/c/aether/aether-demo.git/tree/, but I have not been able to understand why the following within a subclass of

How to use Aether (eclipse) in Maven Plugins using API 3.1.1?

人盡茶涼 提交于 2020-01-13 19:02:27
问题 I am developing a new Maven plugin using API v3.1.1 because I need to upgrade to Maven 3.1.1, and need the Aether way of dealing with artifact repositories, among other things retrieving the complete list of artifact versions. I am using Eclipse Aether (0.9.0.M4), NOT Sonatype Aether. I have already read through http://wiki.eclipse.org/Aether and tried the demos http://git.eclipse.org/c/aether/aether-demo.git/tree/, but I have not been able to understand why the following within a subclass of

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

心已入冬 提交于 2020-01-01 04:56:08
问题 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

Can I use Maven repository manager outside of Maven?

落花浮王杯 提交于 2019-12-25 01:27:18
问题 I already asked in Maven User List, let me duplicate here. I'm trying to create an application that will download and use Maven artifacts outside of Maven. I think that in this case the smartest way would be to use Maven already existing classes. Can anyone help me with a hint where to look for? Would be nice to make it working this way: Repository rep = new Repository("~/.m2"); Artifact artifact = new Artifact("com.example", "foo", "1.0"); String path = rep.resolve(artifact); assert path

Utility for downloading artifacts from maven repo without mvn/poms [closed]

寵の児 提交于 2019-12-23 13:32:18
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Is there a maven client that isn't mvn (the binary included with the maven distribution) I could use to pull down an artifact from a maven repository without using a pom? I'd like to use a maven repository as the repo for our ops team to pick up builds (including snapshots of builds) but I don't want them to

Error injecting DefaultRepositorySystem in maven-plugin-testing-harness

久未见 提交于 2019-12-23 07:51:07
问题 I am trying to create a new maven (3.0.3) plugin based on an existing (2.0) plugin, and facilitating aether to pickup some dependencies. I tried to create a simple test to load the mojo using the maven-plugin-testing-harness (version 2.0.1), but lookupMojo fails with a guice exception: 1) Error injecting: org.sonatype.aether.impl.internal.DefaultRepositorySystem at ClassRealm[plexus.core, parent: null] at ClassRealm[plexus.core, parent: null] while locating org.sonatype.aether

How do I download a jar using maven programatically

[亡魂溺海] 提交于 2019-12-21 12:19:17
问题 I am writing an application that requires me to download a jar given the mavens groupid/artifactid/version. I currently start with public Model pomToModel(String pomUrl) throws Exception { URL url = new URL(pomUrl); InputStream stream = url.openStream(); try { Model model = new MavenXpp3Reader().read(stream); return model; } finally { stream.close(); } } So given the url of the POM, I now have the maven Model object representing it. This seems to work well. What I would like to do know is two

How to programmatically list all transitive dependencies, including overridden ones in Maven using DependencyGraphBuilder?

一笑奈何 提交于 2019-12-21 02:21:09
问题 This is similar to other questions (like this), but I want to be able to do this with the latest API's. The maven-dependency-plugin:tree verbose option has been deprecated and does nothing in the latest (2.5.1) code, so there is no good example of how to do it. 回答1: I believe Aether utility class from jcabi-aether can help you to get a list of all dependencies of any Maven artifact, for example: File repo = this.session.getLocalRepository().getBasedir(); Collection<Artifact> deps = new Aether

Fetching Maven artifacts programmatically [closed]

爱⌒轻易说出口 提交于 2019-12-18 03:32:25
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I'm looking for a Java API which can be used to retreive Maven artifacts from a remote repository. I've found Eclipse Ather so far but it looks over complicated for my needs so i'm seeking for something more simple. What i need is: I have to specify the location of the remote Maven repository I like to fetch an