Hmm, maybe a plugin is in order for this.  As I thought about it some, assembly 
plugin isn't going to do anything to create a POM.  Makes sense in hindsight, 
assembly is for creating distributions and not Maven artifacts.  Shade plugin 
has facilities to generate a POM for the shaded jar which could be adapted for 
this case as well.

Seems there's not much way around two artifacts per build in this case, 
otherwise the core artifact is going to have to depend on unit testing 
artifacts, which is bad in this situation.

On Aug 26, 2011, at 2:15 AM, Anders Hammar wrote:

> Yep, I've run into a similar thing. In my case the tests were using
> classes in my core project, which would have been solvable by
> implementing interfaces (in a separate project). So both the tests
> artifact and the core artifact would then have a dependency to the
> core-api artifact.
> But you know the drill, dev team is under time pressure and just wants
> to do the release. So they kept the tests jar (with that classifier)
> in the core project. A real PIA for all other teams as they now don't
> get the transitive deps when they reuse that tests artifact.
> 
> /Anders
> 
> On Fri, Aug 26, 2011 at 04:26, Brian Topping <[email protected]> wrote:
>> Hi all,
>> 
>> I have typical module with tests, but the tests inherit from a base class.  
>> This base class (and a few related classes/resources) need to be generated 
>> as a separate jar so they can be used as a test scope dependency.
>> 
>> It initially seems like it would be an easy enough task for jar:test-jar, 
>> but that's going to include all the tests as well.  An <exclude> could be 
>> used, but the output still has <classifier>tests</classifier>, which is not 
>> quite correct.
>> 
>> The second option I looked at was to create a separate project for the base 
>> class and friends, but since the base class depends on classes in this first 
>> module, a circular dependency is formed.  The jar for the base class clearly 
>> needs to be created in the same project (i.e. one build creating two 
>> artifacts).
>> 
>> This would be easy enough to do with the assembly plugin, but out of 
>> academic curiosity, have others come across this problem and solved it 
>> differently?
>> 
>> Thanks for any input, Brian
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to