Author: dan.j.allen
Date: 2010-08-03 14:41:28 -0400 (Tue, 03 Aug 2010)
New Revision: 6882
Modified:
archetypes/javaee6-webapp/trunk/src/test/java/com/mycompany/MavenArtifactResolver.java
Log:
add support for maven.repo.local override; update docs
Modified:
archetypes/javaee6-webapp/trunk/src/test/java/com/mycompany/MavenArtifactResolver.java
===================================================================
---
archetypes/javaee6-webapp/trunk/src/test/java/com/mycompany/MavenArtifactResolver.java 2010-08-03
18:40:50 UTC (rev 6881)
+++
archetypes/javaee6-webapp/trunk/src/test/java/com/mycompany/MavenArtifactResolver.java 2010-08-03
18:41:28 UTC (rev 6882)
@@ -8,7 +8,7 @@
*
* <p>This approach is an interim solution for Maven projects
* until the open feature request to add formally add artifacts
- * to a test (ARQ-66) is implementated.</p>
+ * 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
@@ -21,14 +21,31 @@
* 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("user.home") + File.separatorChar +
- ".m2" + File.separatorChar + "repository";
+ 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(String groupId, String artifactId, String version)
{