maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Boué <guillaume_b...@orange.fr>
Subject Re: Create test jar during build without attaching
Date Sat, 20 Aug 2016 00:06:55 GMT
Hi,

It sounds like the simplest answer would be to use the 
maven-assembly-plugin and generate the JAR in the 
generate-test-resources phase. You can configure the plugin not to 
attach the artifact with <attach>false</false>.

Then, still in the generate-test-resources phase, you bind an execution 
of build-helper-maven-plugin:add-test-resource and configure it to add 
the generated JAR as a test resource: 
http://www.mojohaus.org/build-helper-maven-plugin/usage.html#Add_more_resource_directories_to_your_project


Le 19/08/2016 à 23:37, Curtis Rueden a écrit :
> Generate it during generateSources using a groovy script via gmaven? Or in
> Java within the test code itself?
>
> On Aug 19, 2016 4:21 PM, "Christopher" <ctubbsii@apache.org> wrote:
>
>> We're not going to add the jar to SCM.... there's many reasons, and I could
>> go into depth about all of them (I've tried to enumerate some already), but
>> again... that's not the question. We're not going to do that. and I've
>> already stated that. I appreciate the advice... really, I do... but we're
>> not going to do that. Responding with that suggestion does not help answer
>> the question asked.
>>
>> The purpose of this thread is to figure out the best way to create a jar
>> during the build without attaching. That's the requirement. That's the
>> goal.
>>
>> On Fri, Aug 19, 2016 at 5:09 PM Curtis Rueden <ctrueden@wisc.edu> wrote:
>>
>>> Hi Christopher,
>>>
>>> The point of this JAR is for use in a unit test, right?
>>>
>>> So if it's in src/test/resources, it will only end up lumped into the
>> test
>>> JAR, not the main JAR. Do you guys deploy your test JAR for downstream
>>> consumption? If so, do you actually need all the unit tests to pass _when
>>> run from the test JAR outside the project_? Or only during the actual
>> Maven
>>> build? Because if you don't need that, then you could just put the JAR
>>> resource outside of src/test/resources (in, say,
>> ${basedir}/src/test/extra
>>> or some such) and just access it from that relative path during the unit
>>> tests. You get your unit test, your test JAR does not get bloated by this
>>> nested JAR resource, and life goes on.
>>>
>>> That said, I agree with the others that naively, it does not seem bad to
>>> have this tiny test JAR embedded in your deployed test JAR. It is a
>> binary
>>> test resource, very similar to an image file.
>>>
>>> Regards,
>>> Curtis
>>>
>>> --
>>> Curtis Rueden
>>> LOCI software architect - http://loci.wisc.edu/software
>>> ImageJ2 lead, Fiji maintainer - http://imagej.net/User:Rueden
>>> Did you know ImageJ has a forum? http://forum.imagej.net/
>>>
>>>
>>> On Fri, Aug 19, 2016 at 1:46 PM, Christopher <ctubbsii@apache.org>
>> wrote:
>>>> We don't want to skip deployment of all the artifacts, just one jar
>> built
>>>> in one module for one test, which is not intended to be one of the
>>>> artifact's modules. *maybe* we could move it to a separate module, and
>>> skip
>>>> deploy, but we've already got a lot of module bloat, and I'd prefer not
>>> to
>>>> make it worse.
>>>>
>>>> On Fri, Aug 19, 2016 at 2:34 PM Gordon Cody <gordon.cody@zafin.com>
>>> wrote:
>>>>> Perhaps I don't understand what is meant by "not attaching" but if
>> all
>>>> you
>>>>> want to do is skip deployment, the maven-deploy-plugin has this
>>> feature:
>>>>>                  <configuration>
>>>>>                      <skip>true</skip>
>>>>>                  </configuration>
>>>>> which can be added to the module you do not wish to deploy. We use
>> this
>>>> in
>>>>> order to not deploy .ear files to our artifactory.
>>>>>
>>>>> Regards, Gord Cody
>>>>>
>>>>> On Fri, Aug 19, 2016 at 1:37 PM, Karl Heinz Marbaise <
>>> khmarbaise@gmx.de>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> On 19/08/16 03:36, Christopher wrote:
>>>>>>
>>>>>>> Hi Maven Users list,
>>>>>>>
>>>>>>> What's the best way to create a jar during a build without
>> attaching
>>>> it?
>>>>>>> Currently, our pom is configured to use the maven-jar-plugin
to
>>> create
>>>>> it,
>>>>>>> but that plugin attaches an artifact, which gets deployed. We
>> don't
>>>> want
>>>>>>> that. That doesn't seem to be configurable.
>>>>>>>
>>>>>> Can you describe why you would like to create a jar which shouldn't
>>> be
>>>>>> deployed ? May be we can enhance maven-jar-plugin to support such
a
>>> use
>>>>>> case?
>>>>>>
>>>>>>
>>>>>> Kind regards
>>>>>> Karl Heinz Marbaise
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------
>> ---------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Best Regards, Gord Cody
>>>>>
>>>>> Release Manager  Zafin Labs Americas Inc.
>>>>> 179 Colonnade Road-Suite 100, Ottawa ON, Canada
>>>>> Phone: +1 (613) 216-2504  Fax: +1 (613) 688-1374  Mobile: +1
>>>> 613-601-2734
>>>>> Web: http://zafin.com  Email: gordon.cody@zafin.com
>>>>>
>>>>> --
>>>>> Zafin - Canada
>>>>>
>>>>> --
>>>>> http://zafin.com
>>>>>
>>>>> <http://zafin.com/>
>>>>>
>>>>> ------------------------------
>>>>>
>>>>> Connect with us
>>>>>
>>>>> <http://www.youtube.com/user/ZafinGlobal>
>>>>> <http://www.linkedin.com/company/Zafin>  <http://twitter.com/Zafin>
>>>>>
>>>>> News and Events
>>>>>
>>>>> Zafin announces 100 person Center of Excellence in Toronto
>>>>> <
>>>>> http://zafin.com/press-releases/zafin-announces-new-
>>>> 100-person-centre-excellence-toronto/
>>>>> For the 2nd consecutive year, Zafin named to the Deloitte Fast 50 and
>>>> Fast
>>>>> 500 rankings
>>>>> <
>>>>> http://zafin.com/press-releases/zafin-named-deloitte-
>>>> technology-fast-50-fast-500-lists/
>>>>> <
>>>>> http://zafin.com/press-releases/zafin-ranks-16th-on-
>>>> the-2014-deloitte-technology-fast-50-list/


---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus
Avast.
https://www.avast.com/antivirus


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message