-
1. Re: An alternative for Maven Artifact Resolver
alrubinger Aug 4, 2010 9:29 AM (in response to michaelschuetz)Yup.
We've yet to investigate the impl, but I'd attached it to https://jira.jboss.org/browse/SHRINKWRAP-140 as a possiblity.Good looking out.
S,
ALR
-
2. Re: An alternative for Maven Artifact Resolver
dan.j.allen Aug 17, 2010 12:27 PM (in response to michaelschuetz)I realize the MavenArtifactResolver class is still a hack, but I have a revised version in the interim that can honor a local Maven repository location override. Note the reference to the maven.repo.local system property.
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(String groupId, String artifactId, String version) { return new File(LOCAL_MAVEN_REPO + File.separatorChar + groupId.replace(".", File.separator) + File.separatorChar + artifactId + File.separatorChar + version + File.separatorChar + artifactId + "-" + version + ".jar"); } public static File resolve(String qualifiedArtifactId) { String[] segments = qualifiedArtifactId.split(":"); return resolve(segments[0], segments[1], segments[2]); } }
To get this class to see the maven.repo.local Maven setting, it has to be promoted to a system property in the surefire plugin configuration:
<plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.4.3</version> <configuration> <systemProperties> <property> <name>maven.repo.local</name> <value>${maven.repo.local}</value> </property> </systemProperties> </configuration> </plugin>
Just an FYI.
-
3. Re: An alternative for Maven Artifact Resolver
michaelschuetz Aug 18, 2010 6:02 PM (in response to dan.j.allen)Great, works nice - I did integrate this with success.
Hint: My MavenArtifactResolverTest (unit test) doesn't work out of IDE (IDEA) anymore, cause property needs to be set within surefire plugin. Running from console just works fine.
-
4. Re: An alternative for Maven Artifact Resolver
michaelschuetz Aug 20, 2010 7:25 AM (in response to dan.j.allen)Hi Dan,
tiny optimization if used Maven 3.* There is a native maven property for currently used loal repo.
{code:xml}
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<systemProperties>
<property>
<name>maven.repo.local</name>
<value>${settings.localRepository}</value>
</property>
</systemProperties>
</configuration>
</plugin>
{code}
This will not work for Maven 2.*
Regards
Michael -
5. Re: An alternative for Maven Artifact Resolver
swd847 Sep 5, 2010 7:55 PM (in response to michaelschuetz)For those who are interested there is also another hacky Maven artifact resolver at:
This one is similar to Dan's, however it works by pulling the artifact locations out of the test class path so it is not nessesary to specify the version in the test, the version from pom.xml is used instead (It is still a massive hack though).
-
6. Re: An alternative for Maven Artifact Resolver
craiggreenhalgh Jun 2, 2011 4:43 AM (in response to michaelschuetz)Does anyone have any ideas how I can include dependences too ?
Thanks
Craig
-
7. Re: An alternative for Maven Artifact Resolver
maschmid Jun 3, 2011 9:30 AM (in response to craiggreenhalgh)There is now new MavenDependencyResolver in Arquillian alpha5/shrinkwrap-alpha-12 that include dependencies atuomatically
see its tests on how to use it... hopefully, there will be some docs soon