You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mark Hobson <ma...@gmail.com> on 2009/09/28 18:16:50 UTC

Buildable standalone source bundles with the assembly plugin

Hi there,

I was wondering if any maven-assembly-plugin experts could say whether
this scenario is possible, or how much work it'd be to implement it.

I need an archive that contains a complete buildable standalone
project bundle.  More specifically, it needs to contain:

1) the full SCM checkout of the main project
2) full SCM checkouts of all dependencies that match a
groupId:artifactId pattern (i.e. internal projects)
3) a local repository containing the binaries for the unmatched
dependencies (i.e. third-party projects)

Ideally, this would then be buildable with a single Maven command by
pointing the reactor to the checked-out projects and configuring the
local repository accordingly.

The nearest issue I could find was MASSEMBLY-125, which looks like it
aims to overlay the project's and dependencies' sources into a single
source-tree.  I need separate directories per dependency since
resource naming conflicts could exist.

Any first impressions appreciated.

Cheers,

Mark

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


Re: Buildable standalone source bundles with the assembly plugin

Posted by Mark Hobson <ma...@gmail.com>.
2009/10/7 Brett Porter <br...@apache.org>:
> On 06/10/2009, at 8:22 PM, Mark Hobson wrote:
>> Oh right, I hadn't seen that mentioned anywhere.  So does -pl support
>> building the project list dynamically from subdirectories like -r
>> does?
>
> Yes, though I think it requires the proper <modules> set up to do so (subset
> of current reactor, not a custom reactor). I think you should write out that
> aggregating file for best future proofing.

Okay, I'll bear that in mind.

>> So just deploy the source-release artifact without the others?  Sure,
>> if you know an easy way of doing this from a tag :)
>
> You'll probably need to make a copy of the code, adjust the POMs for the new
> assembly (but not change the versions), build and then upload the file from
> target manually (or use deploy:deploy-file).
>
> Not sure if that's less work than just doing a new release :)

Yeah, that's the conclusion I came to :)  Thanks for the tips though Brett.

Cheers,

Mark

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


Re: Buildable standalone source bundles with the assembly plugin

Posted by Brett Porter <br...@apache.org>.
On 06/10/2009, at 8:22 PM, Mark Hobson wrote:

>> Note that -r is deprecated in favour of -pl now...
>
> Oh right, I hadn't seen that mentioned anywhere.  So does -pl support
> building the project list dynamically from subdirectories like -r
> does?

Yes, though I think it requires the proper <modules> set up to do so  
(subset of current reactor, not a custom reactor). I think you should  
write out that aggregating file for best future proofing.

>
>>> I do like this idea, although it'd mean releasing new versions of
>>> pre-existing projects to bring in the new attached artifact.
>>
>> couldn't you build the equivalent source bundle for the existing  
>> version,
>> since it is a whole new artifact?
>
> So just deploy the source-release artifact without the others?  Sure,
> if you know an easy way of doing this from a tag :)

You'll probably need to make a copy of the code, adjust the POMs for  
the new assembly (but not change the versions), build and then upload  
the file from target manually (or use deploy:deploy-file).

Not sure if that's less work than just doing a new release :)

- Brett


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


Re: Buildable standalone source bundles with the assembly plugin

Posted by Mark Hobson <ma...@gmail.com>.
2009/10/6 Brett Porter <br...@apache.org>:
> On 02/10/2009, at 12:59 AM, Mark Hobson wrote:
>> Interesting idea, have you got an example of this?
>
> Every Maven project released in the last couple of months does this, or the
> source bundle of Maven itself.

Ah thanks, I didn't realise that'd been done.  I think I skimmed over
that mammoth thread about release profiles ;)

>> I hope to use mvn -r to avoid having to produce an aggregate pom that
>> contains the necessary <module> elements.  Not sure how easy it'll be
>> to coax the SCM plugin into checking out all direct and transitive
>> dependencies of a project though.
>
> Note that -r is deprecated in favour of -pl now...

Oh right, I hadn't seen that mentioned anywhere.  So does -pl support
building the project list dynamically from subdirectories like -r
does?

>> I do like this idea, although it'd mean releasing new versions of
>> pre-existing projects to bring in the new attached artifact.
>
> couldn't you build the equivalent source bundle for the existing version,
> since it is a whole new artifact?

So just deploy the source-release artifact without the others?  Sure,
if you know an easy way of doing this from a tag :)

Cheers,

Mark

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


Re: Buildable standalone source bundles with the assembly plugin

Posted by Brett Porter <br...@apache.org>.
On 02/10/2009, at 12:59 AM, Mark Hobson wrote:

> 2009/10/1 Brett Porter <br...@apache.org>:
>> On 30/09/2009, at 10:48 PM, Mark Hobson wrote:
>>> These are released dependencies.  They need to be SCM checkouts and
>>> not source artifacts since they need to be buildable, i.e. contain  
>>> the
>>> POM and any other necessary build resources.
>>
>> You can build and release source bundles with all of that too :)
>
> Interesting idea, have you got an example of this?

Every Maven project released in the last couple of months does this,  
or the source bundle of Maven itself.

>
>>> I'll investigate these points in more depth once I need to do the
>>> work.  I was mainly trying to gather whether it was appropriate to  
>>> add
>>> this functionality to the assembly plugin.  How did you see the POM
>>> and SCM plugins coming into play here?
>>
>> They were for doing the checkouts into a space the assembly plugin  
>> could
>> pick it up and for modifying the <modules> element to include them  
>> in a
>> build. You could put them in by hand in a profile though that is just
>> enabled by your scripts.
>
> I hope to use mvn -r to avoid having to produce an aggregate pom that
> contains the necessary <module> elements.  Not sure how easy it'll be
> to coax the SCM plugin into checking out all direct and transitive
> dependencies of a project though.

Note that -r is deprecated in favour of -pl now...

>
>> Though if they are releases, I'd find going with source bundles  
>> from the
>> repository easier than using the SCM.
>
> I do like this idea, although it'd mean releasing new versions of
> pre-existing projects to bring in the new attached artifact.

couldn't you build the equivalent source bundle for the existing  
version, since it is a whole new artifact?

- Brett


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


Re: Buildable standalone source bundles with the assembly plugin

Posted by Mark Hobson <ma...@gmail.com>.
2009/10/1 Brett Porter <br...@apache.org>:
> On 30/09/2009, at 10:48 PM, Mark Hobson wrote:
>> These are released dependencies.  They need to be SCM checkouts and
>> not source artifacts since they need to be buildable, i.e. contain the
>> POM and any other necessary build resources.
>
> You can build and release source bundles with all of that too :)

Interesting idea, have you got an example of this?

>> I'll investigate these points in more depth once I need to do the
>> work.  I was mainly trying to gather whether it was appropriate to add
>> this functionality to the assembly plugin.  How did you see the POM
>> and SCM plugins coming into play here?
>
> They were for doing the checkouts into a space the assembly plugin could
> pick it up and for modifying the <modules> element to include them in a
> build. You could put them in by hand in a profile though that is just
> enabled by your scripts.

I hope to use mvn -r to avoid having to produce an aggregate pom that
contains the necessary <module> elements.  Not sure how easy it'll be
to coax the SCM plugin into checking out all direct and transitive
dependencies of a project though.

> Though if they are releases, I'd find going with source bundles from the
> repository easier than using the SCM.

I do like this idea, although it'd mean releasing new versions of
pre-existing projects to bring in the new attached artifact.

Cheers,

Mark

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


Re: Buildable standalone source bundles with the assembly plugin

Posted by Brett Porter <br...@apache.org>.
On 30/09/2009, at 10:48 PM, Mark Hobson wrote:

> Hi Brett,
>
> Thanks for the response, answers inline:
>
> 2009/9/30 Brett Porter <br...@apache.org>:
>> On 29/09/2009, at 2:16 AM, Mark Hobson wrote:
>>> 1) the full SCM checkout of the main project
>>
>> you are calling from within that, or want to do a checkout?
>
> Yep, the main project is the one where we're executing the assembly
> plugin within.  So essentially this part is like the predefined
> 'project' descriptor:
> http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#project
>
>>> 2) full SCM checkouts of all dependencies that match a
>>> groupId:artifactId pattern (i.e. internal projects)
>>
>> are these released dependencies or in development snapshots?
>
> These are released dependencies.  They need to be SCM checkouts and
> not source artifacts since they need to be buildable, i.e. contain the
> POM and any other necessary build resources.

You can build and release source bundles with all of that too :)

>
>>> 3) a local repository containing the binaries for the unmatched
>>> dependencies (i.e. third-party projects)
>>
>> this can already be done with the assembly plugin.
>
> Got that bit working :)
>
> The aim to end up with a complete offline standalone buildable archive
> like this:
>
> bundle.zip
> +- build.sh (shell script to invoke Maven build)
> +- build.bat (batch file version of above)
> +- maven (Maven distributable)
> +- jre (Java JRE for Maven)
> +- settings.xml (settings to point Maven to local repository)
> +- repository (Maven repository of third party artifacts and Maven  
> dependencies)
> +- projects (SCM checkouts of internal projects)
>   +- project A/
>   |  +- pom.xml
>   |  +- src/
>   |     +- ...
>   +- ...
>
> The build would then be invoked by applying the reactor on the
> projects dir and pointing at the local repository.
>
> After a brief initial investigation, it looks like I need the  
> following:
>
> - New feature: Add 'project' type to assembly plugin dependencySet
> (addresses point 2 above)
> - Bug: POM artifacts cannot be excluded from repositories
> - Bug: Add 'useTransitiveDependencies' flag to assembly plugin
> repository (currently cannot keep excluded artifact's transitive
> dependencies)
>
> I'll investigate these points in more depth once I need to do the
> work.  I was mainly trying to gather whether it was appropriate to add
> this functionality to the assembly plugin.  How did you see the POM
> and SCM plugins coming into play here?

They were for doing the checkouts into a space the assembly plugin  
could pick it up and for modifying the <modules> element to include  
them in a build. You could put them in by hand in a profile though  
that is just enabled by your scripts.

Though if they are releases, I'd find going with source bundles from  
the repository easier than using the SCM.

- Brett


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


Re: Buildable standalone source bundles with the assembly plugin

Posted by Mark Hobson <ma...@gmail.com>.
Hi Brett,

Thanks for the response, answers inline:

2009/9/30 Brett Porter <br...@apache.org>:
> On 29/09/2009, at 2:16 AM, Mark Hobson wrote:
>> 1) the full SCM checkout of the main project
>
> you are calling from within that, or want to do a checkout?

Yep, the main project is the one where we're executing the assembly
plugin within.  So essentially this part is like the predefined
'project' descriptor:
http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#project

>> 2) full SCM checkouts of all dependencies that match a
>> groupId:artifactId pattern (i.e. internal projects)
>
> are these released dependencies or in development snapshots?

These are released dependencies.  They need to be SCM checkouts and
not source artifacts since they need to be buildable, i.e. contain the
POM and any other necessary build resources.

>> 3) a local repository containing the binaries for the unmatched
>> dependencies (i.e. third-party projects)
>
> this can already be done with the assembly plugin.

Got that bit working :)

The aim to end up with a complete offline standalone buildable archive
like this:

bundle.zip
+- build.sh (shell script to invoke Maven build)
+- build.bat (batch file version of above)
+- maven (Maven distributable)
+- jre (Java JRE for Maven)
+- settings.xml (settings to point Maven to local repository)
+- repository (Maven repository of third party artifacts and Maven dependencies)
+- projects (SCM checkouts of internal projects)
   +- project A/
   |  +- pom.xml
   |  +- src/
   |     +- ...
   +- ...

The build would then be invoked by applying the reactor on the
projects dir and pointing at the local repository.

After a brief initial investigation, it looks like I need the following:

- New feature: Add 'project' type to assembly plugin dependencySet
(addresses point 2 above)
- Bug: POM artifacts cannot be excluded from repositories
- Bug: Add 'useTransitiveDependencies' flag to assembly plugin
repository (currently cannot keep excluded artifact's transitive
dependencies)

I'll investigate these points in more depth once I need to do the
work.  I was mainly trying to gather whether it was appropriate to add
this functionality to the assembly plugin.  How did you see the POM
and SCM plugins coming into play here?

Cheers,

Mark

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


Re: Buildable standalone source bundles with the assembly plugin

Posted by Brett Porter <br...@apache.org>.
Hi Mark,

This is all possible but you might need to use a combo of the SCM  
plugin, the POM plugin and the assembly plugin. Some questions:

On 29/09/2009, at 2:16 AM, Mark Hobson wrote:


>
> I need an archive that contains a complete buildable standalone
> project bundle.  More specifically, it needs to contain:
>
> 1) the full SCM checkout of the main project

you are calling from within that, or want to do a checkout?

> 2) full SCM checkouts of all dependencies that match a
> groupId:artifactId pattern (i.e. internal projects)

are these released dependencies or in development snapshots?

> 3) a local repository containing the binaries for the unmatched
> dependencies (i.e. third-party projects)

this can already be done with the assembly plugin.

- Brett


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