> -----Original Message----- > From: Brett Porter [mailto:[EMAIL PROTECTED] > Sent: lundi 29 août 2005 03:53 > To: Maven Developers List > Subject: Re: [m2] Retrieving test dependencies in junit tests? > > We had an open issue for this and decided to push it off for now. In our > use case, there isn't really a good way for m2 to propogate information > to JUnit without some intervening tool library, or system properties > which are obviously limited. > > The problem with knowing the local repository location is that you must > also know the path structure. While I don't envisage this changing from > the new format any time soon it'd be good to be able to have that freedom. > > The preferred way would be to use ${localRepository} in a plugin and get > localRepository.pathOf( artifact ).
I find it a bit awkward to have to develop a plugin and to host it alongside project sources. Actually I've never seen this done so far probably for the reason that anytime there was a need it found its way into m2 proper. > That said, we are currently setting and using the system property > ${maven.repo.local} in unit tests for modello. I'd considered that an > "undocumented" feature (as in deliberately undocument, unlike most of > the features which we intend to document :) I don't understand why you mention modello. If you're setting the property in the model unit tests then how do you get the value in the first place? I've tried doing a System.getProperty( "maven.repo.local" ) in my unit test and it returns null. So I'm not sure it is set anywhere in m2. Is the local repo available as property in the POM? If so, I could use it and pass it to surefire using a system property? Thanks -Vincent > Vincent Massol wrote: > > >Hi, > > > >I'm continuing my quest to convert the m1 Cargo build into m2. Thanks to > >John and his implementation for inheriting properties I have now reached > the > >next level. > > > >The Cargo functional test subprojects depend on some other subprojects > which > >produce J2EE modules (WAR, EAR, etc). Those are used for testing > deployment > >to a container. > > > >Thus, I need to get the file path of those dependencies from within a > JUnit > >TestCase class. How can I implement this? > > > >In m1, the way I had implemented it was a bit hacky: > >- There was a property: cargo.testdata.dir = > >${maven.repo.local}/${pom.groupId} > >- The path to the J2EE module in the local repository was computed within > >the TestCase > > > >Is there a property pointing to the local repo location that I could use > in > >the pom.xml file (same as ${maven.repo.local} is used in m1)? > > > >Obviously I'd rather not have to write a plugin for such a use case... I > >think there's a potential need to gather all kind of information about > the > >POM in a JUnit TestCase and it might be interesting to implement this in > a > >generic way. WDYT? > > > >Thanks > >-Vincent ___________________________________________________________________________ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]