On Dec 10, 2012, at 11:51 PM, Adam Murdoch <[email protected]> wrote:

> 
> On 10/12/2012, at 11:09 AM, Daz DeBoer wrote:
> 
>> 
>> 
>> On 6 December 2012 15:42, Adam Murdoch <[email protected]> wrote:
>> 
>> On 07/12/2012, at 8:36 AM, Daz DeBoer wrote:
>> 
>> Just to recap where we've gotten to so far, I think we have the following 
>> options. 
>> 
>> Note: for all these options, there will be a DSL to allow you do explicitly 
>> declare the components to be published.
>> 
>> 1. Publish nothing by default:
>>      * Either the 'java' plugin or a new 'jvm-library' plugin (or both) 
>> registers a jvm-library component.
>>      * Need to declare exactly what to publish via the DSL.
>>  
>> I guess publishing everything would be as simple as something like:
>> 
>> publications {
>>      publish components.all // Not sure if 'publish' is the right keyword 
>> here?
>> }
>> 
>> This option also removes the question of what to publish when no 
>> component/publication is available (it's no longer implicit).
>> 
>> Would we want to provide a way to publish certain components to particular 
>> repositories?
> 
> Possibly. There's 4 parts to the publishing stuff, which would combine:
> 
> 1. Declaring 'publish these components' is simply shorthand for 'add these 
> components to the default Ivy and Maven publications'.
> 2. There is a capability to add a component to a publication.
> 3. There is a capability to add new (empty) Ivy and Maven publications.
> 4. There is a capability to publish a publication to a repository. We have 
> this now in the publish tasks.
> 
> So, if you really wanted, you could do something like this:
> 
> 1. Apply the 'publish' plugin instead of the 'ivy-publish' or 'maven-publish' 
> plugins, so that nothing is published by default.
> 2. Add (empty) publications 'a' and 'b'.
> 3. Add components 1 and 2 to publication 'a', and component 3 to publication 
> 'b'.
> 4. Add repositories 'internal' and 'external'.
> 5. Add a task that publishes publication 'a' to repo 'internal' and 
> publication 'b' to repo 'external'.
> 6. Wire up 'publish' to depend on these 2 tasks.
> 
> Maybe there'll be some DSL support for this kind of thing at some point, if 
> we hit the use cases. The plan for now is that there's infrastructure 
> (repositories, publications, components and a few task types) that you need 
> to wire together yourself, and a very small number of opinionated plugins 
> that will wire it together for you in exactly one way (publish everything to 
> every repository).
> 
> 
>> 
>> 
>> 2. Publish a single thing, inferred from the set of components declared for 
>> the project.
>>      * Either the 'java' plugin or a new 'jvm-library' plugin (or both) 
>> registers a jvm-library component.
>>      * Can replace or add to the inferred component via the DSL.
>>      * Two variations for the rule:
>>              * if there is exactly one component, then use it.
>>              * if there is exactly one component, then use it. When there 
>> are multiple components, then 2jee app wins over web app wins over jvm 
>> library wins over jvm component.
>>      * Fail if we can't infer the component to publish.
>> 
>> 3. Publish everything, by default don't publish the jar:
>>      * The 'java' plugin does not register any component.
>>      * A new 'jvm-library' plugin registers jvm-library component.
>>      * This implies that the 'war' and 'application' plugins will not 
>> implicitly add a jvm-library component.
>> 
>> I think the 'publish every component' could work pretty well, if we assume 
>> that the existing plugins will not register any components:
>>     * For starters, we have 'jvm-library' and 'j2ee-web-application' 
>> components, with new plugins that add them to the model.
>>     * 'java' & 'war' plugins do not register any components
>>     * Publishing will attempt to publish all registered components. 
>>     * Publishing multiple components will fail gracefully, until we 
>> implement and test properly.
>>     * Publishing with no components will fail.
> 
> I'm not sure it does work that well. One problem is that that java and war 
> plugins really do define components - a jvm-based component and a j2ee web 
> application respectively.
> 
> The other is that it stops working once you look beyond the jar + war case:
> 
> * If I have an j2ee app that bundles the web app, then I only want to publish 
> the web app. So, in this case I apply the 'ear' and 'war' (or 
> 'j2ee-web-application') plugin. I only want the ear published, but I'm going 
> to end up with both the ear and war published.

If you distribute the building of the ear content over multiple subprojects, 
then you also might want that the war subproject does not publish the war, 
although it is the only plugin applied to this subproject.

Hans

Reply via email to