I should also add. There seem to be 3 issues here:

* Adding a :test classifier to a module set include, should include the test
jar.
* The syntax of the artifact vector needs to be clarified in documentation,
wrt how wild cards are used. That is, is it group:artifact:*:*:test or
group:artifact:*:test or ...
* When specifying a test classifier is it 'test' or 'tests'? The scope seems
to be called 'test' and the classifier seems to be 'tests', this is very
confusing.

Are there JIRAs for the above/should I create them?

Rupert

On 19 April 2011 12:40, Rupert Smith <[email protected]> wrote:

> Ok this worked:
>
>     <files>
>         <file>
>
>  
> <source>genzero-runtests/target/genzero-runtests-${genzero.version}-tests.jar</source>
>             <outputDirectory>lib</outputDirectory>
>             <filtered>false</filtered>
>             <fileMode>0644</fileMode> <!-- User RW, Group/Other R. -->
>         </file>
>     </files>
>
> And in the top-level POM:
>
>     <properties>
>         <genzero.version>1.2-RC4-SNAPSHOT</genzero.version>
>
> (I have a bash script that uses sed on the POM files to bump the version).
>
> Is it better practice to define the assembly plugin in the top-level POM or
> in a seperate module? e.g.
>
> /pom.xml  <----- here
> module1/pom.xml (code + tests)
> build-module/pom.xml <------- or here?
>
> The reason I ask is that it occurs to be that the top-level pom cannot have
> module1 as a dependency (cyclic), but build-module could. Therefore, from
> build-module module1 and module1:test might both be visible as dependencies
> of the assembly.
>
> If anyone know a less cludgy way to include my tests, please enlighten me.
> For now, I need to get on with setting up some testing...
>
> Rupert
>
> On 19 April 2011 12:29, Rupert Smith <[email protected]> wrote:
>
>> Logically, that would seem to be the wrong place to specify the scope; It
>> isn't that junit-toolkit as a dependency is not being found, its
>> genzero-runtime-VERSION-tests.jar which is the parent of that dependency
>> which is not even being picked up. However, I tried your suggestion out:
>>
>>         <moduleSet>
>>             <includes>
>>
>>  
>> <include>com.rapidaddition:genzero-runtests:jar:1.2-RC4-SNAPSHOT:tests</include>
>>             </includes>
>>             <binaries>
>>                 <outputDirectory>lib</outputDirectory>
>>                 <unpack>false</unpack>
>>                 <fileMode>0644</fileMode> <!-- User RW, Group/Other R. -->
>>                 <directoryMode>0755</directoryMode> <!-- User RWX,
>> Group/Other RX. -->
>>                 <dependencySets>
>>                     <dependencySet>
>>                         <includes>
>>                             <include>com.thesett:junit-toolkit</include>
>>                         </includes>
>>                         <scope>tests</scope>
>>                     </dependencySet>
>>                 </dependencySets>
>>             </binaries>
>>         </moduleSet>
>>
>> I tried a scope value of 'test' and 'tests', but neither work.
>>
>> I also tried putting the genzero-runtests dependency, not in a module set
>> (after all its not a module but an additional jar arising as a side effect
>> of building a module), but in a dependencySet at the top level of the
>> assembly XML. This did not work either (tried scope test/tests there too), I
>> guess because it is not a dependency of the top-level POM where the assembly
>> plugin is defined.
>>
>> Maybe a fileSet with a hard coded path to the target directory where the
>> .jar can be found at the end of the build? I can put the version in a
>> variable and hope that variable expansion works in the path definition,
>> e.g.,
>> <include>genzero-runtest/target/genzero-runtests-${project.version}-test.jar</include>.
>> Cludgy, but do I feel lucky?
>>
>> Rupert
>>
>> On 19 April 2011 12:14, Eike Kettner <[email protected]> wrote:
>>
>>> Hi
>>>
>>> did you try to add test scope using the <scope/> tag inside the
>>> <dependencySet> tag? It's default value is "runtime"...
>>>
>>> found here
>>>
>>> http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_dependencySet
>>>
>>>
>>> regards,
>>> Eike
>>>
>>>
>>> On [Tue, 19.04.2011 12:07], Rupert Smith wrote:
>>> > This question has come up a few times, but I see no definite answer in
>>> the
>>> > replies. If someone known how to do this, please let me know, I am
>>> tearing
>>> > my hair out and its no fun running the build over and over again an
>>> looking
>>> > at the output to see if it worked....
>>> >
>>> > This is the relevant section of my assembly.xml:
>>> >
>>> >         <moduleSet>
>>> >             <includes>
>>> >
>>> <include>com.rapidaddition:genzero-runtests:*:test</include>
>>> >             </includes>
>>> >             <binaries>
>>> >                 <outputDirectory>lib</outputDirectory>
>>> >                 <unpack>false</unpack>
>>> >                 <fileMode>0644</fileMode> <!-- User RW, Group/Other R.
>>> -->
>>> >                 <directoryMode>0755</directoryMode> <!-- User RWX,
>>> > Group/Other RX. -->
>>> >                 <dependencySets>
>>> >                     <dependencySet>
>>> >                         <includes>
>>> >
>>> <include>com.thesett:junit-toolkit</include>
>>> >                         </includes>
>>> >                     </dependencySet>
>>> >                 </dependencySets>
>>> >             </binaries>
>>> >         </moduleSet>
>>> >
>>> > For the module include I have also tried:
>>> >
>>> > com.rapidaddition:genzero-runtests:*:*:test
>>> > com.rapidaddition:genzero-runtests:*:tests
>>> > com.rapidaddition:genzero-runtests:*:*:tests
>>> >
>>> > But none seems to be right. Perhaps I should try filling in the type
>>> and
>>> > version too?
>>> >
>>> > Is including a test jar actually possible?
>>> >
>>> > To head of the inevitable question, why would I want to do such a
>>> thing... I
>>> > could put the tests in a separate module and include as an ordinary jar
>>> with
>>> > no 'test' classifier, but.... I want these to be unit tests that run on
>>> > every build AND I want to put them in an assembly to create a
>>> distribution
>>> > that I can give to customers who want a copy of the tests to run on
>>> their
>>> > own hardware too.
>>> >
>>> > Many thanks for any assistance.
>>> >
>>> > Rupert
>>>
>>> --
>>> email: [email protected]   https://www.eknet.org  pgp: 481161A0
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>

Reply via email to