You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Gabriele Columbro (JIRA)" <ji...@codehaus.org> on 2009/06/26 13:53:05 UTC
[jira] Commented: (SUREFIRE-545) Enable custom JAR and resource
loading in Surefire classpath
[ http://jira.codehaus.org/browse/SUREFIRE-545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=181616#action_181616 ]
Gabriele Columbro commented on SUREFIRE-545:
--------------------------------------------
Anyone has something to say about this? :)
Thanks in advance.
> Enable custom JAR and resource loading in Surefire classpath
> ------------------------------------------------------------
>
> Key: SUREFIRE-545
> URL: http://jira.codehaus.org/browse/SUREFIRE-545
> Project: Maven Surefire
> Issue Type: Improvement
> Components: classloading
> Affects Versions: 2.4.3
> Environment: any
> Reporter: Gabriele Columbro
> Priority: Minor
> Attachments: SurefireResourceLoading.diff
>
>
> There are situations in which you would want to add to surefire classpath an arbitrary resourceSet to have your tests running properly.
> To clarify, there are cases in which maven transitive dependency management cannot be enough for having your classpath populated properly, cases in which not even the <additionalClasspathElement> of surefire can be enough, unless you pollute your pom with a huge numer of <additionalClasspathElement> lines (tough to write and maintain).
> Maybe an example can clarify the situation:
> if you're working with a legacy Webapp, say a WAR built with Ant, that has no POM, but you want to use Maven features to improve testing and to provide a standard approach to lifecycle management. You'd like be able to test in isolation (outside of a container) against the webapp classpath, but while WEB-INF/classes can be loaded with <additionalClasspathElement>, you'd name each and every JAR in the WEB-INF/lib to have the classpath properly populate.
> This is infact my case when trying to support Alfresco ECM [1] testing with my maven archetypes [2].
> So, after playing around with Java6 classpath wildcard loading [3] (which seems not to be honored by surefire), I wrote this little patch which adds to surefire a new configuration parameter:
> <resources>
> <resource>
> ....
> </resource>
> </resources>
> which allows to load arbitrary resources in the surefire classpath, using the usual directory/include/exclude format supported by the Maven DirectoryScanner. This solves my problems as now I can happily load the Alfresco's WEB-INF/lib/*.jar resourceSet.
> It does not check for duplicates so it's left to the developer to check it the maven transitive classpath clashes with the added resources (as this should be discouraged, I think it should stay like this).
> I understand this should be discouraged, but I could not find a way to work this around (until Alfresco release his POM [4]) in the current surefire setup.
> WDYT? Shall I write a test case or you think is never going to make it to the trunk? ;)
> [1] http://www.alfresco.com/
> [2] http://repository.sourcesense.com/maven2-sites/maven-alfresco-archetypes
> [3] http://www.javabeat.net/qna/90-adding-jars-to-the-classpath/
> [4] https://issues.alfresco.com/jira/browse/ETHREEOH-1090
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira