Author: dan.j.allen
Date: 2011-04-24 17:59:57 -0400 (Sun, 24 Apr 2011)
New Revision: 7238
Removed:
archetypes/javaee6-webapp/trunk/src/test/java/com/mycompany/test/MavenArtifactResolver.java
Log:
remove in favor of dep mgmt in arquillian 1.0.0.Alpha5
Deleted:
archetypes/javaee6-webapp/trunk/src/test/java/com/mycompany/test/MavenArtifactResolver.java
===================================================================
---
archetypes/javaee6-webapp/trunk/src/test/java/com/mycompany/test/MavenArtifactResolver.java 2011-04-24
21:58:48 UTC (rev 7237)
+++
archetypes/javaee6-webapp/trunk/src/test/java/com/mycompany/test/MavenArtifactResolver.java 2011-04-24
21:59:57 UTC (rev 7238)
@@ -1,81 +0,0 @@
-package com.mycompany.test;
-
-import java.io.File;
-
-/**
- * A temporary resolver that converts a Maven artifact reference into a {@link
java.io.File} object.
- *
- * <p>
- * This approach is an interim solution for Maven projects until the open feature request
to add formally add artifacts to a
- * test (<a
href="https://jira.jboss.org/browse/ARQ-66">ARQ-66</a>)
is implementated.
- * </p>
- *
- * <p>
- * The testCompile goal will resolve any test dependencies and put them in your local
Maven repository. By the time the test
- * executes, you can be sure that the JAR files you need will be in your local
repository.
- * </p>
- *
- * <p>
- * Example usage:
- * </p>
- *
- * <pre>
- * WebArchive war = ShrinkWrap.create("test.war",
WebArchive.class).addLibrary(
- *
MavenArtifactResolver.resolve("commons-lang:commons-lang:2.5"));
- * </pre>
- *
- * <p>
- * If you are using an alternate local Maven repository, you need to pass it to the Maven
surefire plugin using the following
- * stanza in the plugin configuration element:
- * </p>
- *
- * <pre>
- * <systemProperties>
- * <property>
- * <name>maven.repo.local</name>
- * <value>${maven.repo.local}</value>
- * </property>
- * </systemProperties>
- * </pre>
- *
- * <p>
- * Another approach to pull in a library is to add packages recursively from the root
library package.
- * </p>
- *
- * @author Dan Allen
- */
-public class MavenArtifactResolver {
- private static final String LOCAL_MAVEN_REPO =
System.getProperty("maven.repo.local") != null ? System
- .getProperty("maven.repo.local") :
(System.getProperty("user.home") + File.separatorChar + ".m2"
- + File.separatorChar + "repository");
-
- public static File resolve(final String groupId, final String artifactId, final
String version) {
- return resolve(groupId, artifactId, version, null);
- }
-
- public static File resolve(final String groupId, final String artifactId, final
String version, final String classifier) {
- return new File(LOCAL_MAVEN_REPO + File.separatorChar +
groupId.replace(".", File.separator) + File.separatorChar
- + artifactId + File.separatorChar + version + File.separatorChar +
artifactId + "-" + version
- + (classifier != null ? ("-" + classifier) : "") +
".jar");
- }
-
- public static File resolve(final String qualifiedArtifactId) {
- String[] segments = qualifiedArtifactId.split(":");
- if (segments.length == 3) {
- return resolve(segments[0], segments[1], segments[2]);
- } else if (segments.length == 4) {
- return resolve(segments[0], segments[1], segments[2], segments[3]);
- }
- throw new IllegalArgumentException("Invalid format for qualified artifactId:
" + qualifiedArtifactId);
- }
-
- public static File[] resolveAll(final String... qualifiedArtifactIds) {
- int n = qualifiedArtifactIds.length;
- File[] artifacts = new File[n];
- for (int i = 0; i < n; i++) {
- artifacts[i] = resolve(qualifiedArtifactIds[i]);
- }
-
- return artifacts;
- }
-}