Repository: maven-aether Updated Branches: refs/heads/demo [created] 322fa5564
Bug 358765 - Initial contribution continued - aether-demo Project: http://git-wip-us.apache.org/repos/asf/maven-aether/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-aether/commit/2b0ef628 Tree: http://git-wip-us.apache.org/repos/asf/maven-aether/tree/2b0ef628 Diff: http://git-wip-us.apache.org/repos/asf/maven-aether/diff/2b0ef628 Branch: refs/heads/demo Commit: 2b0ef6289553103b678a24c4e9c17f17f528ced8 Parents: Author: Benjamin Bentmann <[email protected]> Authored: Wed Oct 26 10:13:50 2011 +0200 Committer: Benjamin Bentmann <[email protected]> Committed: Wed Oct 26 10:13:50 2011 +0200 ---------------------------------------------------------------------- .gitignore | 8 + aether-demo-maven-plugin/pom.xml | 121 ++++++++++++++ .../src/it/resolve-artifact/pom.xml | 43 +++++ aether-demo-maven-plugin/src/it/settings.xml | 47 ++++++ .../aether/demo/maven/ResolveArtifactMojo.java | 97 +++++++++++ aether-demo-snippets/demo.jar | Bin 0 -> 345 bytes aether-demo-snippets/pom.xml | 117 +++++++++++++ .../org/eclipse/aether/demo/AllAetherDemos.java | 32 ++++ .../eclipse/aether/demo/DeployArtifacts.java | 57 +++++++ .../aether/demo/FindAvailableVersions.java | 57 +++++++ .../eclipse/aether/demo/FindNewestVersion.java | 56 +++++++ .../eclipse/aether/demo/GetDependencyTree.java | 54 ++++++ .../aether/demo/GetDirectDependencies.java | 56 +++++++ .../eclipse/aether/demo/InstallArtifacts.java | 52 ++++++ .../eclipse/aether/demo/ResolveArtifact.java | 54 ++++++ .../demo/ResolveTransitiveDependencies.java | 67 ++++++++ .../org/eclipse/aether/demo/aether/Aether.java | 120 ++++++++++++++ .../eclipse/aether/demo/aether/AetherDemo.java | 67 ++++++++ .../aether/demo/aether/AetherResult.java | 45 +++++ .../manual/ManualRepositorySystemFactory.java | 41 +++++ .../aether/demo/manual/ManualWagonProvider.java | 39 +++++ .../plexus/PlexusRepositorySystemFactory.java | 38 +++++ .../org/eclipse/aether/demo/util/Booter.java | 53 ++++++ .../demo/util/ConsoleDependencyGraphDumper.java | 59 +++++++ .../demo/util/ConsoleRepositoryListener.java | 123 ++++++++++++++ .../demo/util/ConsoleTransferListener.java | 164 +++++++++++++++++++ pom.xml | 128 +++++++++++++++ 27 files changed, 1795 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0e36d40 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +target/ +.project +.classpath +.settings/ +.idea +*.iml +*.ipr +*.iws http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-maven-plugin/pom.xml ---------------------------------------------------------------------- diff --git a/aether-demo-maven-plugin/pom.xml b/aether-demo-maven-plugin/pom.xml new file mode 100644 index 0000000..f947c29 --- /dev/null +++ b/aether-demo-maven-plugin/pom.xml @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + ~ Copyright (c) 2010, 2011 Sonatype, Inc. + ~ All rights reserved. This program and the accompanying materials + ~ are made available under the terms of the Eclipse Public License v1.0 + ~ which accompanies this distribution, and is available at + ~ http://www.eclipse.org/legal/epl-v10.html + ~ + ~ Contributors: + ~ Sonatype, Inc. - initial API and implementation +--> + +<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>org.eclipse.aether</groupId> + <artifactId>aether-demos</artifactId> + <version>0.9.0-SNAPSHOT</version> + </parent> + + <artifactId>aether-demo-maven-plugin</artifactId> + <packaging>maven-plugin</packaging> + + <name>Aether Demo Maven Plugin</name> + <description> + A simple Maven plugin using Aether. + </description> + <inceptionYear>2010</inceptionYear> + + <prerequisites> + <maven>3.0.4</maven> + </prerequisites> + + <properties> + <mavenVersion>3.0</mavenVersion> + <aetherVersion>0.9.0-SNAPSHOT</aetherVersion> + <forgeReleaseUrl>https://repository.sonatype.org/service/local/staging/deploy/maven2</forgeReleaseUrl> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>${mavenVersion}</version> + <exclusions> + <exclusion> + <groupId>org.apache.maven</groupId> + <artifactId>maven-model</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.maven</groupId> + <artifactId>maven-artifact</artifactId> + </exclusion> + <exclusion> + <groupId>org.sonatype.sisu</groupId> + <artifactId>sisu-inject-plexus</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.eclipse.aether</groupId> + <artifactId>aether-api</artifactId> + <version>${aetherVersion}</version> + </dependency> + <dependency> + <groupId>org.eclipse.aether</groupId> + <artifactId>aether-util</artifactId> + <version>${aetherVersion}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>animal-sniffer-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>run-its</id> + <build> + <plugins> + <plugin> + <artifactId>maven-invoker-plugin</artifactId> + <version>1.5</version> + <configuration> + <debug>false</debug> + <projectsDirectory>src/it</projectsDirectory> + <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo> + <pomIncludes> + <pomInclude>*/pom.xml</pomInclude> + </pomIncludes> + <preBuildHookScript>setup</preBuildHookScript> + <postBuildHookScript>verify</postBuildHookScript> + <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath> + <settingsFile>src/it/settings.xml</settingsFile> + <goals> + <goal>clean</goal> + <goal>validate</goal> + </goals> + </configuration> + <executions> + <execution> + <id>integration-test</id> + <goals> + <goal>install</goal> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-maven-plugin/src/it/resolve-artifact/pom.xml ---------------------------------------------------------------------- diff --git a/aether-demo-maven-plugin/src/it/resolve-artifact/pom.xml b/aether-demo-maven-plugin/src/it/resolve-artifact/pom.xml new file mode 100644 index 0000000..41e6721 --- /dev/null +++ b/aether-demo-maven-plugin/src/it/resolve-artifact/pom.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + ~ Copyright (c) 2010, 2011 Sonatype, Inc. + ~ All rights reserved. This program and the accompanying materials + ~ are made available under the terms of the Eclipse Public License v1.0 + ~ which accompanies this distribution, and is available at + ~ http://www.eclipse.org/legal/epl-v10.html + ~ + ~ Contributors: + ~ Sonatype, Inc. - initial API and implementation +--> + +<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>org.eclipse.aether.demo.its.ra</groupId> + <artifactId>test</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>jar</packaging> + + <build> + <plugins> + <plugin> + <groupId>@project.groupId@</groupId> + <artifactId>@project.artifactId@</artifactId> + <version>@project.version@</version> + <executions> + <execution> + <id>test</id> + <phase>validate</phase> + <goals> + <goal>resolve-artifact</goal> + </goals> + <configuration> + <artifactCoords>junit:junit:3.8.2</artifactCoords> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-maven-plugin/src/it/settings.xml ---------------------------------------------------------------------- diff --git a/aether-demo-maven-plugin/src/it/settings.xml b/aether-demo-maven-plugin/src/it/settings.xml new file mode 100644 index 0000000..7150c15 --- /dev/null +++ b/aether-demo-maven-plugin/src/it/settings.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + ~ Copyright (c) 2010, 2011 Sonatype, Inc. + ~ All rights reserved. This program and the accompanying materials + ~ are made available under the terms of the Eclipse Public License v1.0 + ~ which accompanies this distribution, and is available at + ~ http://www.eclipse.org/legal/epl-v10.html + ~ + ~ Contributors: + ~ Sonatype, Inc. - initial API and implementation +--> + +<settings> + <profiles> + <profile> + <id>it-repo</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <repositories> + <repository> + <id>local.central</id> + <url>@localRepositoryUrl@</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>local.central</id> + <url>@localRepositoryUrl@</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + </profile> + </profiles> +</settings> http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-maven-plugin/src/main/java/org/eclipse/aether/demo/maven/ResolveArtifactMojo.java ---------------------------------------------------------------------- diff --git a/aether-demo-maven-plugin/src/main/java/org/eclipse/aether/demo/maven/ResolveArtifactMojo.java b/aether-demo-maven-plugin/src/main/java/org/eclipse/aether/demo/maven/ResolveArtifactMojo.java new file mode 100644 index 0000000..c613381 --- /dev/null +++ b/aether-demo-maven-plugin/src/main/java/org/eclipse/aether/demo/maven/ResolveArtifactMojo.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo.maven; + +import java.util.List; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactRequest; +import org.eclipse.aether.resolution.ArtifactResolutionException; +import org.eclipse.aether.resolution.ArtifactResult; +import org.eclipse.aether.util.artifact.DefaultArtifact; + +/** + * @goal resolve-artifact + */ +public class ResolveArtifactMojo + extends AbstractMojo +{ + + /** + * The entry point to Aether, i.e. the component doing all the work. + * + * @component + */ + private RepositorySystem repoSystem; + + /** + * The current repository/network configuration of Maven. + * + * @parameter default-value="${repositorySystemSession}" + * @readonly + */ + private RepositorySystemSession repoSession; + + /** + * The project's remote repositories to use for the resolution. + * + * @parameter default-value="${project.remoteProjectRepositories}" + * @readonly + */ + private List<RemoteRepository> remoteRepos; + + /** + * The {@code <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>} of the artifact to resolve. + * + * @parameter expression="${aether.artifactCoords}" + */ + private String artifactCoords; + + public void execute() + throws MojoExecutionException, MojoFailureException + { + Artifact artifact; + try + { + artifact = new DefaultArtifact( artifactCoords ); + } + catch ( IllegalArgumentException e ) + { + throw new MojoFailureException( e.getMessage(), e ); + } + + ArtifactRequest request = new ArtifactRequest(); + request.setArtifact( artifact ); + request.setRepositories( remoteRepos ); + + getLog().info( "Resolving artifact " + artifact + " from " + remoteRepos ); + + ArtifactResult result; + try + { + result = repoSystem.resolveArtifact( repoSession, request ); + } + catch ( ArtifactResolutionException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + + getLog().info( "Resolved artifact " + artifact + " to " + result.getArtifact().getFile() + " from " + + result.getRepository() ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/demo.jar ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/demo.jar b/aether-demo-snippets/demo.jar new file mode 100644 index 0000000..5fcb2f7 Binary files /dev/null and b/aether-demo-snippets/demo.jar differ http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/pom.xml ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/pom.xml b/aether-demo-snippets/pom.xml new file mode 100644 index 0000000..9eeb35e --- /dev/null +++ b/aether-demo-snippets/pom.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + ~ Copyright (c) 2010, 2011 Sonatype, Inc. + ~ All rights reserved. This program and the accompanying materials + ~ are made available under the terms of the Eclipse Public License v1.0 + ~ which accompanies this distribution, and is available at + ~ http://www.eclipse.org/legal/epl-v10.html + ~ + ~ Contributors: + ~ Sonatype, Inc. - initial API and implementation +--> + +<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>org.eclipse.aether</groupId> + <artifactId>aether-demos</artifactId> + <version>0.9.0-SNAPSHOT</version> + </parent> + + <artifactId>aether-demo-snippets</artifactId> + + <name>Aether Demo Snippets</name> + <description> + A module to demonstrate the usage of Aether by means of various runnable code snippets. + </description> + + <properties> + <aetherVersion>0.9.0-SNAPSHOT</aetherVersion> + <mavenVersion>3.0.3</mavenVersion> + <wagonVersion>1.0</wagonVersion> + </properties> + + <dependencies> + <dependency> + <groupId>org.eclipse.aether</groupId> + <artifactId>aether-api</artifactId> + <version>${aetherVersion}</version> + </dependency> + <dependency> + <groupId>org.eclipse.aether</groupId> + <artifactId>aether-spi</artifactId> + <version>${aetherVersion}</version> + </dependency> + <dependency> + <groupId>org.eclipse.aether</groupId> + <artifactId>aether-util</artifactId> + <version>${aetherVersion}</version> + </dependency> + <dependency> + <groupId>org.eclipse.aether</groupId> + <artifactId>aether-impl</artifactId> + <version>${aetherVersion}</version> + </dependency> + <dependency> + <groupId>org.eclipse.aether</groupId> + <artifactId>aether-connector-file</artifactId> + <version>${aetherVersion}</version> + </dependency> + <dependency> + <groupId>org.eclipse.aether</groupId> + <artifactId>aether-connector-wagon</artifactId> + <version>${aetherVersion}</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-aether-provider</artifactId> + <version>${mavenVersion}</version> + <exclusions> + <exclusion> + <groupId>org.sonatype.aether</groupId> + <artifactId>aether-impl</artifactId> + </exclusion> + <exclusion> + <groupId>org.sonatype.aether</groupId> + <artifactId>aether-spi</artifactId> + </exclusion> + <exclusion> + <groupId>org.sonatype.aether</groupId> + <artifactId>aether-util</artifactId> + </exclusion> + <exclusion> + <groupId>org.sonatype.aether</groupId> + <artifactId>aether-api</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-provider-api</artifactId> + <version>${wagonVersion}</version> + </dependency> + <dependency> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-http-lightweight</artifactId> + <version>${wagonVersion}</version> + <exclusions> + <exclusion> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-http-shared</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-utils</artifactId> + <version>2.0.7</version> + </dependency> + <dependency> + <groupId>org.sonatype.sisu</groupId> + <artifactId>sisu-inject-plexus</artifactId> + <version>2.3.0</version> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/AllAetherDemos.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/AllAetherDemos.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/AllAetherDemos.java new file mode 100644 index 0000000..e9c06af --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/AllAetherDemos.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo; + +/** + * Runs all demos at once. + */ +public class AllAetherDemos +{ + + public static void main( String[] args ) + throws Exception + { + FindAvailableVersions.main( args ); + FindNewestVersion.main( args ); + GetDirectDependencies.main( args ); + GetDependencyTree.main( args ); + ResolveArtifact.main( args ); + ResolveTransitiveDependencies.main( args ); + InstallArtifacts.main( args ); + DeployArtifacts.main( args ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/DeployArtifacts.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/DeployArtifacts.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/DeployArtifacts.java new file mode 100644 index 0000000..a700eff --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/DeployArtifacts.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo; + +import java.io.File; + +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.demo.util.Booter; +import org.eclipse.aether.deployment.DeployRequest; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.util.artifact.DefaultArtifact; +import org.eclipse.aether.util.artifact.SubArtifact; + + +/** + * Deploys a JAR and its POM to a remote repository. + */ +public class DeployArtifacts +{ + + public static void main( String[] args ) + throws Exception + { + System.out.println( "------------------------------------------------------------" ); + System.out.println( DeployArtifacts.class.getSimpleName() ); + + RepositorySystem system = Booter.newRepositorySystem(); + + RepositorySystemSession session = Booter.newRepositorySystemSession( system ); + + Artifact jarArtifact = new DefaultArtifact( "test", "org.eclipse.aether.demo", "", "jar", "0.1-SNAPSHOT" ); + jarArtifact = jarArtifact.setFile( new File( "org.eclipse.aether.demo.jar" ) ); + + Artifact pomArtifact = new SubArtifact( jarArtifact, "", "pom" ); + pomArtifact = pomArtifact.setFile( new File( "pom.xml" ) ); + + RemoteRepository distRepo = + new RemoteRepository( "org.eclipse.aether.demo", "default", new File( "target/dist-repo" ).toURI().toString() ); + + DeployRequest deployRequest = new DeployRequest(); + deployRequest.addArtifact( jarArtifact ).addArtifact( pomArtifact ); + deployRequest.setRepository( distRepo ); + + system.deploy( session, deployRequest ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/FindAvailableVersions.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/FindAvailableVersions.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/FindAvailableVersions.java new file mode 100644 index 0000000..b827864 --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/FindAvailableVersions.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo; + +import java.util.List; + +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.demo.util.Booter; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.VersionRangeRequest; +import org.eclipse.aether.resolution.VersionRangeResult; +import org.eclipse.aether.util.artifact.DefaultArtifact; +import org.eclipse.aether.version.Version; + + +/** + * Determines all available versions of an artifact. + */ +public class FindAvailableVersions +{ + + public static void main( String[] args ) + throws Exception + { + System.out.println( "------------------------------------------------------------" ); + System.out.println( FindAvailableVersions.class.getSimpleName() ); + + RepositorySystem system = Booter.newRepositorySystem(); + + RepositorySystemSession session = Booter.newRepositorySystemSession( system ); + + Artifact artifact = new DefaultArtifact( "org.sonatype.aether:aether-util:[0,)" ); + + RemoteRepository repo = Booter.newCentralRepository(); + + VersionRangeRequest rangeRequest = new VersionRangeRequest(); + rangeRequest.setArtifact( artifact ); + rangeRequest.addRepository( repo ); + + VersionRangeResult rangeResult = system.resolveVersionRange( session, rangeRequest ); + + List<Version> versions = rangeResult.getVersions(); + + System.out.println( "Available versions " + versions ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/FindNewestVersion.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/FindNewestVersion.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/FindNewestVersion.java new file mode 100644 index 0000000..4ca2fa0 --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/FindNewestVersion.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo; + +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.demo.util.Booter; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.VersionRangeRequest; +import org.eclipse.aether.resolution.VersionRangeResult; +import org.eclipse.aether.util.artifact.DefaultArtifact; +import org.eclipse.aether.version.Version; + + +/** + * Determines the newest version of an artifact. + */ +public class FindNewestVersion +{ + + public static void main( String[] args ) + throws Exception + { + System.out.println( "------------------------------------------------------------" ); + System.out.println( FindNewestVersion.class.getSimpleName() ); + + RepositorySystem system = Booter.newRepositorySystem(); + + RepositorySystemSession session = Booter.newRepositorySystemSession( system ); + + Artifact artifact = new DefaultArtifact( "org.sonatype.aether:aether-util:[0,)" ); + + RemoteRepository repo = Booter.newCentralRepository(); + + VersionRangeRequest rangeRequest = new VersionRangeRequest(); + rangeRequest.setArtifact( artifact ); + rangeRequest.addRepository( repo ); + + VersionRangeResult rangeResult = system.resolveVersionRange( session, rangeRequest ); + + Version newestVersion = rangeResult.getHighestVersion(); + + System.out.println( "Newest version " + newestVersion + " from repository " + + rangeResult.getRepository( newestVersion ) ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/GetDependencyTree.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/GetDependencyTree.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/GetDependencyTree.java new file mode 100644 index 0000000..9468395 --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/GetDependencyTree.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo; + +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.collection.CollectRequest; +import org.eclipse.aether.collection.CollectResult; +import org.eclipse.aether.demo.util.Booter; +import org.eclipse.aether.demo.util.ConsoleDependencyGraphDumper; +import org.eclipse.aether.graph.Dependency; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.util.artifact.DefaultArtifact; + + +/** + * Collects the transitive dependencies of an artifact. + */ +public class GetDependencyTree +{ + + public static void main( String[] args ) + throws Exception + { + System.out.println( "------------------------------------------------------------" ); + System.out.println( GetDependencyTree.class.getSimpleName() ); + + RepositorySystem system = Booter.newRepositorySystem(); + + RepositorySystemSession session = Booter.newRepositorySystemSession( system ); + + Artifact artifact = new DefaultArtifact( "org.apache.maven:maven-aether-provider:3.0.2" ); + + RemoteRepository repo = Booter.newCentralRepository(); + + CollectRequest collectRequest = new CollectRequest(); + collectRequest.setRoot( new Dependency( artifact, "" ) ); + collectRequest.addRepository( repo ); + + CollectResult collectResult = system.collectDependencies( session, collectRequest ); + + collectResult.getRoot().accept( new ConsoleDependencyGraphDumper() ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/GetDirectDependencies.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/GetDirectDependencies.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/GetDirectDependencies.java new file mode 100644 index 0000000..44f9e63 --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/GetDirectDependencies.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo; + +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.demo.util.Booter; +import org.eclipse.aether.graph.Dependency; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactDescriptorRequest; +import org.eclipse.aether.resolution.ArtifactDescriptorResult; +import org.eclipse.aether.util.artifact.DefaultArtifact; + + +/** + * Determines the direct dependencies of an artifact as declared in its artifact descriptor (POM). + */ +public class GetDirectDependencies +{ + + public static void main( String[] args ) + throws Exception + { + System.out.println( "------------------------------------------------------------" ); + System.out.println( GetDirectDependencies.class.getSimpleName() ); + + RepositorySystem system = Booter.newRepositorySystem(); + + RepositorySystemSession session = Booter.newRepositorySystemSession( system ); + + Artifact artifact = new DefaultArtifact( "org.sonatype.aether:aether-impl:1.13" ); + + RemoteRepository repo = Booter.newCentralRepository(); + + ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest(); + descriptorRequest.setArtifact( artifact ); + descriptorRequest.addRepository( repo ); + + ArtifactDescriptorResult descriptorResult = system.readArtifactDescriptor( session, descriptorRequest ); + + for ( Dependency dependency : descriptorResult.getDependencies() ) + { + System.out.println( dependency ); + } + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/InstallArtifacts.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/InstallArtifacts.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/InstallArtifacts.java new file mode 100644 index 0000000..75db100 --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/InstallArtifacts.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo; + +import java.io.File; + +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.demo.util.Booter; +import org.eclipse.aether.installation.InstallRequest; +import org.eclipse.aether.util.artifact.DefaultArtifact; +import org.eclipse.aether.util.artifact.SubArtifact; + + +/** + * Installs a JAR and its POM to the local repository. + */ +public class InstallArtifacts +{ + + public static void main( String[] args ) + throws Exception + { + System.out.println( "------------------------------------------------------------" ); + System.out.println( InstallArtifacts.class.getSimpleName() ); + + RepositorySystem system = Booter.newRepositorySystem(); + + RepositorySystemSession session = Booter.newRepositorySystemSession( system ); + + Artifact jarArtifact = new DefaultArtifact( "test", "org.eclipse.aether.demo", "", "jar", "0.1-SNAPSHOT" ); + jarArtifact = jarArtifact.setFile( new File( "org.eclipse.aether.demo.jar" ) ); + + Artifact pomArtifact = new SubArtifact( jarArtifact, "", "pom" ); + pomArtifact = pomArtifact.setFile( new File( "pom.xml" ) ); + + InstallRequest installRequest = new InstallRequest(); + installRequest.addArtifact( jarArtifact ).addArtifact( pomArtifact ); + + system.install( session, installRequest ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/ResolveArtifact.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/ResolveArtifact.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/ResolveArtifact.java new file mode 100644 index 0000000..766b6ac --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/ResolveArtifact.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo; + +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.demo.util.Booter; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactRequest; +import org.eclipse.aether.resolution.ArtifactResult; +import org.eclipse.aether.util.artifact.DefaultArtifact; + + +/** + * Resolves a single artifact. + */ +public class ResolveArtifact +{ + + public static void main( String[] args ) + throws Exception + { + System.out.println( "------------------------------------------------------------" ); + System.out.println( ResolveArtifact.class.getSimpleName() ); + + RepositorySystem system = Booter.newRepositorySystem(); + + RepositorySystemSession session = Booter.newRepositorySystemSession( system ); + + Artifact artifact = new DefaultArtifact( "org.sonatype.aether:aether-util:1.13" ); + + RemoteRepository repo = Booter.newCentralRepository(); + + ArtifactRequest artifactRequest = new ArtifactRequest(); + artifactRequest.setArtifact( artifact ); + artifactRequest.addRepository( repo ); + + ArtifactResult artifactResult = system.resolveArtifact( session, artifactRequest ); + + artifact = artifactResult.getArtifact(); + + System.out.println( artifact + " resolved to " + artifact.getFile() ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/ResolveTransitiveDependencies.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/ResolveTransitiveDependencies.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/ResolveTransitiveDependencies.java new file mode 100644 index 0000000..dd3f6ce --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/ResolveTransitiveDependencies.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo; + +import java.util.List; + +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.collection.CollectRequest; +import org.eclipse.aether.demo.util.Booter; +import org.eclipse.aether.graph.Dependency; +import org.eclipse.aether.graph.DependencyFilter; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactResult; +import org.eclipse.aether.resolution.DependencyRequest; +import org.eclipse.aether.util.artifact.DefaultArtifact; +import org.eclipse.aether.util.artifact.JavaScopes; +import org.eclipse.aether.util.filter.DependencyFilterUtils; + + +/** + * Resolves the transitive (compile) dependencies of an artifact. + */ +public class ResolveTransitiveDependencies +{ + + public static void main( String[] args ) + throws Exception + { + System.out.println( "------------------------------------------------------------" ); + System.out.println( ResolveTransitiveDependencies.class.getSimpleName() ); + + RepositorySystem system = Booter.newRepositorySystem(); + + RepositorySystemSession session = Booter.newRepositorySystemSession( system ); + + Artifact artifact = new DefaultArtifact( "org.sonatype.aether:aether-impl:1.13" ); + + RemoteRepository repo = Booter.newCentralRepository(); + + DependencyFilter classpathFlter = DependencyFilterUtils.classpathFilter( JavaScopes.COMPILE ); + + CollectRequest collectRequest = new CollectRequest(); + collectRequest.setRoot( new Dependency( artifact, JavaScopes.COMPILE ) ); + collectRequest.addRepository( repo ); + + DependencyRequest dependencyRequest = new DependencyRequest( collectRequest, classpathFlter ); + + List<ArtifactResult> artifactResults = + system.resolveDependencies( session, dependencyRequest ).getArtifactResults(); + + for ( ArtifactResult artifactResult : artifactResults ) + { + System.out.println( artifactResult.getArtifact() + " resolved to " + artifactResult.getArtifact().getFile() ); + } + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/aether/Aether.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/aether/Aether.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/aether/Aether.java new file mode 100644 index 0000000..274d41f --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/aether/Aether.java @@ -0,0 +1,120 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo.aether; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.collection.CollectRequest; +import org.eclipse.aether.demo.util.Booter; +import org.eclipse.aether.demo.util.ConsoleDependencyGraphDumper; +import org.eclipse.aether.deployment.DeployRequest; +import org.eclipse.aether.deployment.DeploymentException; +import org.eclipse.aether.graph.Dependency; +import org.eclipse.aether.graph.DependencyNode; +import org.eclipse.aether.installation.InstallRequest; +import org.eclipse.aether.installation.InstallationException; +import org.eclipse.aether.repository.Authentication; +import org.eclipse.aether.repository.LocalRepository; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.DependencyRequest; +import org.eclipse.aether.resolution.DependencyResolutionException; +import org.eclipse.aether.util.DefaultRepositorySystemSession; +import org.eclipse.aether.util.artifact.DefaultArtifact; +import org.eclipse.aether.util.graph.PreorderNodeListGenerator; + + +public class Aether +{ + private String remoteRepository; + + private RepositorySystem repositorySystem; + + private LocalRepository localRepository; + + public Aether( String remoteRepository, String localRepository ) + { + this.remoteRepository = remoteRepository; + this.repositorySystem = Booter.newRepositorySystem(); + this.localRepository = new LocalRepository( localRepository ); + } + + private RepositorySystemSession newSession() + { + DefaultRepositorySystemSession session = Booter.newRepositorySystemSession( repositorySystem ); + session.setLocalRepositoryManager( repositorySystem.newLocalRepositoryManager( localRepository ) ); + return session; + } + + public AetherResult resolve( String groupId, String artifactId, String version ) + throws DependencyResolutionException + { + RepositorySystemSession session = newSession(); + Dependency dependency = + new Dependency( new DefaultArtifact( groupId, artifactId, "", "jar", version ), "runtime" ); + RemoteRepository central = new RemoteRepository( "central", "default", remoteRepository ); + + CollectRequest collectRequest = new CollectRequest(); + collectRequest.setRoot( dependency ); + collectRequest.addRepository( central ); + + DependencyRequest dependencyRequest = new DependencyRequest(); + dependencyRequest.setCollectRequest( collectRequest ); + + DependencyNode rootNode = repositorySystem.resolveDependencies( session, dependencyRequest ).getRoot(); + + StringBuilder dump = new StringBuilder(); + displayTree( rootNode, dump ); + + PreorderNodeListGenerator nlg = new PreorderNodeListGenerator(); + rootNode.accept( nlg ); + + return new AetherResult( rootNode, nlg.getFiles(), nlg.getClassPath() ); + } + + public void install( Artifact artifact, Artifact pom ) + throws InstallationException + { + RepositorySystemSession session = newSession(); + + InstallRequest installRequest = new InstallRequest(); + installRequest.addArtifact( artifact ).addArtifact( pom ); + + repositorySystem.install( session, installRequest ); + } + + public void deploy( Artifact artifact, Artifact pom, String remoteRepository ) + throws DeploymentException + { + RepositorySystemSession session = newSession(); + + RemoteRepository nexus = new RemoteRepository( "nexus", "default", remoteRepository ); + Authentication authentication = new Authentication( "admin", "admin123" ); + nexus.setAuthentication( authentication ); + + DeployRequest deployRequest = new DeployRequest(); + deployRequest.addArtifact( artifact ).addArtifact( pom ); + deployRequest.setRepository( nexus ); + + repositorySystem.deploy( session, deployRequest ); + } + + private void displayTree( DependencyNode node, StringBuilder sb ) + { + ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 ); + node.accept( new ConsoleDependencyGraphDumper( new PrintStream( os ) ) ); + sb.append( os.toString() ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/aether/AetherDemo.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/aether/AetherDemo.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/aether/AetherDemo.java new file mode 100644 index 0000000..8d21429 --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/aether/AetherDemo.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo.aether; + +import java.io.File; +import java.util.List; + +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.deployment.DeploymentException; +import org.eclipse.aether.graph.DependencyNode; +import org.eclipse.aether.installation.InstallationException; +import org.eclipse.aether.resolution.DependencyResolutionException; +import org.eclipse.aether.util.artifact.DefaultArtifact; +import org.eclipse.aether.util.artifact.SubArtifact; + +@SuppressWarnings( "unused" ) +public class AetherDemo +{ + + public void resolve() + throws DependencyResolutionException + { + Aether aether = new Aether( "http://localhost:8081/nexus/content/groups/public", "/Users/jvanzyl/aether-repo" ); + + AetherResult result = aether.resolve( "com.mycompany.app", "super-app", "1.0" ); + + // Get the root of the resolved tree of artifacts + // + DependencyNode root = result.getRoot(); + + // Get the list of files for the artifacts resolved + // + List<File> artifacts = result.getResolvedFiles(); + + // Get the classpath of the artifacts resolved + // + String classpath = result.getResolvedClassPath(); + } + + public void installAndDeploy() + throws InstallationException, DeploymentException + { + Aether aether = new Aether( "http://localhost:8081/nexus/content/groups/public", "/Users/jvanzyl/aether-repo" ); + + Artifact artifact = new DefaultArtifact( "com.mycompany.super", "super-core", "jar", "0.1-SNAPSHOT" ); + artifact = artifact.setFile( new File( "jar-from-whatever-process.jar" ) ); + Artifact pom = new SubArtifact( artifact, null, "pom" ); + pom = pom.setFile( new File( "pom-from-whatever-process.xml" ) ); + + // Install into the local repository specified + // + aether.install( artifact, pom ); + + // Deploy to a remote reposistory + // + aether.deploy( artifact, pom, "http://localhost:8081/nexus/content/repositories/snapshots/" ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/aether/AetherResult.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/aether/AetherResult.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/aether/AetherResult.java new file mode 100644 index 0000000..cf2b449 --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/aether/AetherResult.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo.aether; + +import java.io.File; +import java.util.List; + +import org.eclipse.aether.graph.DependencyNode; + +public class AetherResult +{ + private DependencyNode root; + private List<File> resolvedFiles; + private String resolvedClassPath; + + public AetherResult( DependencyNode root, List<File> resolvedFiles, String resolvedClassPath ) + { + this.root = root; + this.resolvedFiles = resolvedFiles; + this.resolvedClassPath = resolvedClassPath; + } + + public DependencyNode getRoot() + { + return root; + } + + public List<File> getResolvedFiles() + { + return resolvedFiles; + } + + public String getResolvedClassPath() + { + return resolvedClassPath; + } +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/manual/ManualRepositorySystemFactory.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/manual/ManualRepositorySystemFactory.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/manual/ManualRepositorySystemFactory.java new file mode 100644 index 0000000..11aa788 --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/manual/ManualRepositorySystemFactory.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo.manual; + +import org.apache.maven.repository.internal.DefaultServiceLocator; +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.connector.file.FileRepositoryConnectorFactory; +import org.eclipse.aether.connector.wagon.WagonProvider; +import org.eclipse.aether.connector.wagon.WagonRepositoryConnectorFactory; +import org.eclipse.aether.spi.connector.RepositoryConnectorFactory; + +/** + * A factory for repository system instances that employs Aether's built-in service locator infrastructure to wire up + * the system's components. + */ +public class ManualRepositorySystemFactory +{ + + public static RepositorySystem newRepositorySystem() + { + /* + * Aether's components implement org.eclipse.aether.spi.locator.Service to ease manual wiring and using the + * prepopulated DefaultServiceLocator, we only need to register the repository connector factories. + */ + DefaultServiceLocator locator = new DefaultServiceLocator(); + locator.addService( RepositoryConnectorFactory.class, FileRepositoryConnectorFactory.class ); + locator.addService( RepositoryConnectorFactory.class, WagonRepositoryConnectorFactory.class ); + locator.setServices( WagonProvider.class, new ManualWagonProvider() ); + + return locator.getService( RepositorySystem.class ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/manual/ManualWagonProvider.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/manual/ManualWagonProvider.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/manual/ManualWagonProvider.java new file mode 100644 index 0000000..af75da0 --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/manual/ManualWagonProvider.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo.manual; + +import org.apache.maven.wagon.Wagon; +import org.apache.maven.wagon.providers.http.LightweightHttpWagon; +import org.eclipse.aether.connector.wagon.WagonProvider; + +/** + * A simplistic provider for wagon instances when no Plexus-compatible IoC container is used. + */ +public class ManualWagonProvider + implements WagonProvider +{ + + public Wagon lookup( String roleHint ) + throws Exception + { + if ( "http".equals( roleHint ) ) + { + return new LightweightHttpWagon(); + } + return null; + } + + public void release( Wagon wagon ) + { + + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/plexus/PlexusRepositorySystemFactory.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/plexus/PlexusRepositorySystemFactory.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/plexus/PlexusRepositorySystemFactory.java new file mode 100644 index 0000000..8d3f41e --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/plexus/PlexusRepositorySystemFactory.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo.plexus; + +import org.codehaus.plexus.DefaultPlexusContainer; +import org.eclipse.aether.RepositorySystem; + +/** + * A factory for repository system instances that employs Plexus to wire up the system's components. + */ +public class PlexusRepositorySystemFactory +{ + + public static RepositorySystem newRepositorySystem() + { + /* + * Aether's components are equipped with plexus-specific metadata to enable discovery and wiring of components + * by a Plexus container so this is as easy as looking up the implementation. + */ + try + { + return new DefaultPlexusContainer().lookup( RepositorySystem.class ); + } + catch ( Exception e ) + { + throw new IllegalStateException( "dependency injection failed", e ); + } + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/Booter.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/Booter.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/Booter.java new file mode 100644 index 0000000..8be5593 --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/Booter.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo.util; + +import org.apache.maven.repository.internal.MavenRepositorySystemSession; +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.demo.manual.ManualRepositorySystemFactory; +import org.eclipse.aether.repository.LocalRepository; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.util.DefaultRepositorySystemSession; + + +/** + * A helper to boot the repository system and a repository system session. + */ +public class Booter +{ + + public static RepositorySystem newRepositorySystem() + { + return ManualRepositorySystemFactory.newRepositorySystem(); + } + + public static DefaultRepositorySystemSession newRepositorySystemSession( RepositorySystem system ) + { + MavenRepositorySystemSession session = new MavenRepositorySystemSession(); + + LocalRepository localRepo = new LocalRepository( "target/local-repo" ); + session.setLocalRepositoryManager( system.newLocalRepositoryManager( localRepo ) ); + + session.setTransferListener( new ConsoleTransferListener() ); + session.setRepositoryListener( new ConsoleRepositoryListener() ); + + // uncomment to generate dirty trees + // session.setDependencyGraphTransformer( null ); + + return session; + } + + public static RemoteRepository newCentralRepository() + { + return new RemoteRepository( "central", "default", "http://repo1.maven.org/maven2/" ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/ConsoleDependencyGraphDumper.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/ConsoleDependencyGraphDumper.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/ConsoleDependencyGraphDumper.java new file mode 100644 index 0000000..960eeda --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/ConsoleDependencyGraphDumper.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo.util; + +import java.io.PrintStream; + +import org.eclipse.aether.graph.DependencyNode; +import org.eclipse.aether.graph.DependencyVisitor; + +/** + * A dependency visitor that dumps the graph to the console. + */ +public class ConsoleDependencyGraphDumper + implements DependencyVisitor +{ + + private PrintStream out; + + private String currentIndent = ""; + + public ConsoleDependencyGraphDumper() + { + this( null ); + } + + public ConsoleDependencyGraphDumper( PrintStream out ) + { + this.out = ( out != null ) ? out : System.out; + } + + public boolean visitEnter( DependencyNode node ) + { + out.println( currentIndent + node ); + if ( currentIndent.length() <= 0 ) + { + currentIndent = "+- "; + } + else + { + currentIndent = "| " + currentIndent; + } + return true; + } + + public boolean visitLeave( DependencyNode node ) + { + currentIndent = currentIndent.substring( 3, currentIndent.length() ); + return true; + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/ConsoleRepositoryListener.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/ConsoleRepositoryListener.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/ConsoleRepositoryListener.java new file mode 100644 index 0000000..3bf0cb5 --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/ConsoleRepositoryListener.java @@ -0,0 +1,123 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo.util; + +import java.io.PrintStream; + +import org.eclipse.aether.AbstractRepositoryListener; +import org.eclipse.aether.RepositoryEvent; + +/** + * A simplistic repository listener that logs events to the console. + */ +public class ConsoleRepositoryListener + extends AbstractRepositoryListener +{ + + private PrintStream out; + + public ConsoleRepositoryListener() + { + this( null ); + } + + public ConsoleRepositoryListener( PrintStream out ) + { + this.out = ( out != null ) ? out : System.out; + } + + public void artifactDeployed( RepositoryEvent event ) + { + out.println( "Deployed " + event.getArtifact() + " to " + event.getRepository() ); + } + + public void artifactDeploying( RepositoryEvent event ) + { + out.println( "Deploying " + event.getArtifact() + " to " + event.getRepository() ); + } + + public void artifactDescriptorInvalid( RepositoryEvent event ) + { + out.println( "Invalid artifact descriptor for " + event.getArtifact() + ": " + + event.getException().getMessage() ); + } + + public void artifactDescriptorMissing( RepositoryEvent event ) + { + out.println( "Missing artifact descriptor for " + event.getArtifact() ); + } + + public void artifactInstalled( RepositoryEvent event ) + { + out.println( "Installed " + event.getArtifact() + " to " + event.getFile() ); + } + + public void artifactInstalling( RepositoryEvent event ) + { + out.println( "Installing " + event.getArtifact() + " to " + event.getFile() ); + } + + public void artifactResolved( RepositoryEvent event ) + { + out.println( "Resolved artifact " + event.getArtifact() + " from " + event.getRepository() ); + } + + public void artifactDownloading( RepositoryEvent event ) + { + out.println( "Downloading artifact " + event.getArtifact() + " from " + event.getRepository() ); + } + + public void artifactDownloaded( RepositoryEvent event ) + { + out.println( "Downloaded artifact " + event.getArtifact() + " from " + event.getRepository() ); + } + + public void artifactResolving( RepositoryEvent event ) + { + out.println( "Resolving artifact " + event.getArtifact() ); + } + + public void metadataDeployed( RepositoryEvent event ) + { + out.println( "Deployed " + event.getMetadata() + " to " + event.getRepository() ); + } + + public void metadataDeploying( RepositoryEvent event ) + { + out.println( "Deploying " + event.getMetadata() + " to " + event.getRepository() ); + } + + public void metadataInstalled( RepositoryEvent event ) + { + out.println( "Installed " + event.getMetadata() + " to " + event.getFile() ); + } + + public void metadataInstalling( RepositoryEvent event ) + { + out.println( "Installing " + event.getMetadata() + " to " + event.getFile() ); + } + + public void metadataInvalid( RepositoryEvent event ) + { + out.println( "Invalid metadata " + event.getMetadata() ); + } + + public void metadataResolved( RepositoryEvent event ) + { + out.println( "Resolved metadata " + event.getMetadata() + " from " + event.getRepository() ); + } + + public void metadataResolving( RepositoryEvent event ) + { + out.println( "Resolving metadata " + event.getMetadata() + " from " + event.getRepository() ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/ConsoleTransferListener.java ---------------------------------------------------------------------- diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/ConsoleTransferListener.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/ConsoleTransferListener.java new file mode 100644 index 0000000..04be132 --- /dev/null +++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/demo/util/ConsoleTransferListener.java @@ -0,0 +1,164 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.demo.util; + +import java.io.PrintStream; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.eclipse.aether.transfer.AbstractTransferListener; +import org.eclipse.aether.transfer.TransferEvent; +import org.eclipse.aether.transfer.TransferResource; + +/** + * A simplistic transfer listener that logs uploads/downloads to the console. + */ +public class ConsoleTransferListener + extends AbstractTransferListener +{ + + private PrintStream out; + + private Map<TransferResource, Long> downloads = new ConcurrentHashMap<TransferResource, Long>(); + + private int lastLength; + + public ConsoleTransferListener() + { + this( null ); + } + + public ConsoleTransferListener( PrintStream out ) + { + this.out = ( out != null ) ? out : System.out; + } + + @Override + public void transferInitiated( TransferEvent event ) + { + String message = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading"; + + out.println( message + ": " + event.getResource().getRepositoryUrl() + event.getResource().getResourceName() ); + } + + @Override + public void transferProgressed( TransferEvent event ) + { + TransferResource resource = event.getResource(); + downloads.put( resource, Long.valueOf( event.getTransferredBytes() ) ); + + StringBuilder buffer = new StringBuilder( 64 ); + + for ( Map.Entry<TransferResource, Long> entry : downloads.entrySet() ) + { + long total = entry.getKey().getContentLength(); + long complete = entry.getValue().longValue(); + + buffer.append( getStatus( complete, total ) ).append( " " ); + } + + int pad = lastLength - buffer.length(); + lastLength = buffer.length(); + pad( buffer, pad ); + buffer.append( '\r' ); + + out.print( buffer ); + } + + private String getStatus( long complete, long total ) + { + if ( total >= 1024 ) + { + return toKB( complete ) + "/" + toKB( total ) + " KB "; + } + else if ( total >= 0 ) + { + return complete + "/" + total + " B "; + } + else if ( complete >= 1024 ) + { + return toKB( complete ) + " KB "; + } + else + { + return complete + " B "; + } + } + + private void pad( StringBuilder buffer, int spaces ) + { + String block = " "; + while ( spaces > 0 ) + { + int n = Math.min( spaces, block.length() ); + buffer.append( block, 0, n ); + spaces -= n; + } + } + + @Override + public void transferSucceeded( TransferEvent event ) + { + transferCompleted( event ); + + TransferResource resource = event.getResource(); + long contentLength = event.getTransferredBytes(); + if ( contentLength >= 0 ) + { + String type = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" ); + String len = contentLength >= 1024 ? toKB( contentLength ) + " KB" : contentLength + " B"; + + String throughput = ""; + long duration = System.currentTimeMillis() - resource.getTransferStartTime(); + if ( duration > 0 ) + { + DecimalFormat format = new DecimalFormat( "0.0", new DecimalFormatSymbols( Locale.ENGLISH ) ); + double kbPerSec = ( contentLength / 1024.0 ) / ( duration / 1000.0 ); + throughput = " at " + format.format( kbPerSec ) + " KB/sec"; + } + + out.println( type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len + + throughput + ")" ); + } + } + + @Override + public void transferFailed( TransferEvent event ) + { + transferCompleted( event ); + + event.getException().printStackTrace( out ); + } + + private void transferCompleted( TransferEvent event ) + { + downloads.remove( event.getResource() ); + + StringBuilder buffer = new StringBuilder( 64 ); + pad( buffer, lastLength ); + buffer.append( '\r' ); + out.print( buffer ); + } + + public void transferCorrupted( TransferEvent event ) + { + event.getException().printStackTrace( out ); + } + + protected long toKB( long bytes ) + { + return ( bytes + 1023 ) / 1024; + } + +} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/2b0ef628/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..8e320e5 --- /dev/null +++ b/pom.xml @@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + ~ Copyright (c) 2010, 2011 Sonatype, Inc. + ~ All rights reserved. This program and the accompanying materials + ~ are made available under the terms of the Eclipse Public License v1.0 + ~ which accompanies this distribution, and is available at + ~ http://www.eclipse.org/legal/epl-v10.html + ~ + ~ Contributors: + ~ Sonatype, Inc. - initial API and implementation +--> + +<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>org.sonatype.forge</groupId> + <artifactId>forge-parent</artifactId> + <version>10</version> + </parent> + + <groupId>org.eclipse.aether</groupId> + <artifactId>aether-demos</artifactId> + <version>0.9.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>Aether Demos</name> + <description> + The parent for the Aether demos. + </description> + <url>http://www.eclipse.org/aether/</url> + <inceptionYear>2010</inceptionYear> + + <organization> + <name>The Eclipse Foundation</name> + <url>http://www.eclipse.org/</url> + </organization> + + <mailingLists> + <mailingList> + <name>Aether Developer List</name> + <subscribe>https://dev.eclipse.org/mailman/listinfo/aether-dev</subscribe> + <unsubscribe>https://dev.eclipse.org/mailman/listinfo/aether-dev</unsubscribe> + <post>[email protected]</post> + <archive>http://dev.eclipse.org/mhonarc/lists/aether-dev/</archive> + </mailingList> + <mailingList> + <name>Aether User List</name> + <subscribe>https://dev.eclipse.org/mailman/listinfo/aether-users</subscribe> + <unsubscribe>https://dev.eclipse.org/mailman/listinfo/aether-users</unsubscribe> + <post>[email protected]</post> + <archive>http://dev.eclipse.org/mhonarc/lists/aether-users/</archive> + </mailingList> + </mailingLists> + + <scm> + <connection>scm:git:git://git.eclipse.org/gitroot/aether/aether-demo.git</connection> + <developerConnection>scm:git:ssh://git.eclipse.org/gitroot/aether/aether-demo.git</developerConnection> + <url>http://git.eclipse.org/c/aether/aether-demo.git/</url> + </scm> + + <issueManagement> + <system>bugzilla</system> + <url>https://bugs.eclipse.org/bugs/buglist.cgi?query_format=specific&order=relevance+desc&bug_status=__open__&product=Aether</url> + </issueManagement> + + <licenses> + <license> + <name>Eclipse Public License, Version 1.0</name> + <url>http://www.eclipse.org/legal/epl-v10.html</url> + <distribution>repo</distribution> + </license> + </licenses> + + <properties> + <surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile> + </properties> + + <build> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-deploy-plugin</artifactId> + <configuration> + <!-- the child modules are just source code demos and not to be shared as artifacts --> + <skip>true</skip> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.9</version> + <configuration> + <argLine>-Xmx128m</argLine> + <redirectTestOutputToFile>${surefire.redirectTestOutputToFile}</redirectTestOutputToFile> + <systemPropertyVariables> + <java.io.tmpdir>${project.build.directory}/surefire-tmp</java.io.tmpdir> + </systemPropertyVariables> + </configuration> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>animal-sniffer-maven-plugin</artifactId> + <version>1.7</version> + <configuration> + <signature> + <groupId>org.codehaus.mojo.signature</groupId> + <artifactId>java15</artifactId> + <version>1.0</version> + </signature> + </configuration> + <executions> + <execution> + <id>check-java-1.5-compat</id> + <phase>process-classes</phase> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project>
