You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "a.kraievoy" <ak...@gmail.com> on 2008/10/09 21:49:21 UTC

reusing jar-with-dependencies assembly as primary artifact

Greetings,

kinda simple tweak that apparently makes a lot of pain in maven.

I need to use jar-with-dependencies instead of jar as *primary* artifact for
3 of 9 modules we have in our system. Anyway - the usual jar packaging is
not used in the build process (for those 3 modules), only jar-with-deps, so
the most natural idea is to switch jars somehow.

For now I'm thinking of firing a small ant script doing exactly that
immediately after package phase, so maven does not know I've hacked the jars
and uses the thing I need.

First - I don't like the idea to issue 'mvn install' each time I want to
verify the project (as code changes from modules spill over to the local
repo while subsequent modules may fail). So it would be quite fine to keep
the whole project packageable w/o any local repo updates, e.g. using 'mvn
package' most of the time.

Thus I would like to stick to using only primary artifacts, which are
visible across project siblings in 'mvn package' usecase. Attached artifacts
are not visible, so if a sibling depends on jar-with-deps, and nothing is
installed - then 'mvn package' would bother all the registered remote repos
before failing. 

...and even worse - it would silently use something stale from the local
repo (!), which I am currently trying to prevent. Please remember that 'mvn
install' may install something broken from a module while as some
integration tests in subsequent modules would fail the whole build process.

So - doing an assembly (as most samples suggest) does not fit as it
generates the attached artifact (which requires that unsafe 'install'
scenario).

If I'm doing a custom packaging - I end up loosing a day or so tinkering
with "automagical" maven internals which is of course a non-productive way
to perform such a simple change.

Any ideas, suggestions?

Thanks in advance,
Anton S. Kraievoy

P.S&OFF: We're currently migrating 1KLOC of ant code to maven. I'll try to
do the same for ant + ivy and compare the experience (and leave the most
convenient in charge). Looks like maven currently has vanishing chance to
survive. I'll post an update on this matter in a week or two on my blog:
http://java.akraievoy.org
-- 
View this message in context: http://www.nabble.com/reusing-jar-with-dependencies-assembly-as-primary-artifact-tp19906052p19906052.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: reusing jar-with-dependencies assembly as primary artifact

Posted by Brett Porter <br...@gmail.com>.
Try the shade plugin instead, which has an option to be able to
replace the primary artifact with the new JAR, and has other
processors for merging the JAR.

- Brett

2008/10/10 a.kraievoy <ak...@gmail.com>:
>
> Greetings,
>
> kinda simple tweak that apparently makes a lot of pain in maven.
>
> I need to use jar-with-dependencies instead of jar as *primary* artifact for
> 3 of 9 modules we have in our system. Anyway - the usual jar packaging is
> not used in the build process (for those 3 modules), only jar-with-deps, so
> the most natural idea is to switch jars somehow.
>
> For now I'm thinking of firing a small ant script doing exactly that
> immediately after package phase, so maven does not know I've hacked the jars
> and uses the thing I need.
>
> First - I don't like the idea to issue 'mvn install' each time I want to
> verify the project (as code changes from modules spill over to the local
> repo while subsequent modules may fail). So it would be quite fine to keep
> the whole project packageable w/o any local repo updates, e.g. using 'mvn
> package' most of the time.
>
> Thus I would like to stick to using only primary artifacts, which are
> visible across project siblings in 'mvn package' usecase. Attached artifacts
> are not visible, so if a sibling depends on jar-with-deps, and nothing is
> installed - then 'mvn package' would bother all the registered remote repos
> before failing.
>
> ...and even worse - it would silently use something stale from the local
> repo (!), which I am currently trying to prevent. Please remember that 'mvn
> install' may install something broken from a module while as some
> integration tests in subsequent modules would fail the whole build process.
>
> So - doing an assembly (as most samples suggest) does not fit as it
> generates the attached artifact (which requires that unsafe 'install'
> scenario).
>
> If I'm doing a custom packaging - I end up loosing a day or so tinkering
> with "automagical" maven internals which is of course a non-productive way
> to perform such a simple change.
>
> Any ideas, suggestions?
>
> Thanks in advance,
> Anton S. Kraievoy
>
> P.S&OFF: We're currently migrating 1KLOC of ant code to maven. I'll try to
> do the same for ant + ivy and compare the experience (and leave the most
> convenient in charge). Looks like maven currently has vanishing chance to
> survive. I'll post an update on this matter in a week or two on my blog:
> http://java.akraievoy.org
> --
> View this message in context: http://www.nabble.com/reusing-jar-with-dependencies-assembly-as-primary-artifact-tp19906052p19906052.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>



-- 
Brett Porter
Blog: http://blogs.exist.com/bporter/

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