You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Mauro Talevi <ma...@aquilonia.org> on 2003/04/24 21:42:16 UTC

Issues on java and jar plugins

A couple of issues:

1.  java-plugin:  would a java:compile-rmi goal be useful?
It would simply wrap a call to <ant:rmic> but I find it so.
I could send in a patch if needed.

2.  jar-plugin:  any reason why the <ant:jar> target in <jar:jar>
does not allow the property ${maven.jar.includes}?
How else, eg, is one supposed to create separate separate jars
from a same codebase, when obviously related to the same project,
as eg when wanting to put the RMI stubs in a separate jar?

It would be dead simple to add attribute
       includes="${maven.jar.includes}"
and have it default to include all.

Another application would be separation of api/impl in a project.
At present, you can override jar:jar by defining it in your maven.xml
but I don't see any reason why it cannot be in the plugin.

Trying to enforce good practice is one thing, but limiting equally
good pratices is not good either.

Comments welcome.

Cheers, Mauro



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


Re: Issues on java and jar plugins

Posted by Mauro Talevi <ma...@aquilonia.org>.
Rafal Krzewski wrote:
>  
> Good to have that. I'm not sure if it should go into java plugin,
> or rather into a new rmi plugin (I dont think Maven has one)

yes - could go in both.  Perhaps a more generic remote plugin that
deals with RMI and other distributed-oriented compilers?

> Don't know about the general feeling but my feeling is that this is the
> best what we can do at this moment. I'm not a commiter but I give you
> my +.

I think it would definitely be a big plus (sometimes a *must*) for 
people intenting to migrate to maven to be able to split the jar 
artifact in implementation specific jars.
The argument that holds for artifacts such as war or ear
does not necessarily hold for jars.

m.



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


Re: Issues on java and jar plugins

Posted by Rafal Krzewski <Ra...@caltha.pl>.
Mauro Talevi wrote:
> well, here a solution that works for me (see attached maven.xml)
> 
> 1. defined java:compile-rmi goal to compile RMI stubs

Good to have that. I'm not sure if it should go into java plugin,
or rather into a new rmi plugin (I dont think Maven has one)

> 2. defined jar taglib with a jar tag whose implementation is taken
> from jar:jar with the addition of the includes attribute to <ant:jar>
> 3. defined postGoal to jar:jar to use <jar:jar> tag to create
> multiple jars (just one in this case, but you can call <jar:jar>
> multiple times the postGoal).  Note that the jar:jar goal is called once
> and all the lifecycle is preserved (eg the test prereqs).
> 
> Still - it is not ideal to duplicate the jar:jar goal functionality in
> the taglib.
> 
> What's the general feeling as to adding the a jar taglib to the jar
> plugin and have jar:jar goal use that?

Don't know about the general feeling but my feeling is that this is the
best what we can do at this moment. I'm not a commiter but I give you
my +.

R.


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


Re: Issues on java and jar plugins

Posted by Mauro Talevi <ma...@aquilonia.org>.
Rafal Krzewski wrote:
> 
> 
> I think that until the problem of single project -> multiple artifacts
> scenario is solved, a good temporary solution would be factoring out
> jar:jar goal code into a dynamic tag, so it can be used in the maven.xml
> files in a cleaner way.
> 

well, here a solution that works for me (see attached maven.xml)

1. defined java:compile-rmi goal to compile RMI stubs
2. defined jar taglib with a jar tag whose implementation is taken
from jar:jar with the addition of the includes attribute to <ant:jar>
3. defined postGoal to jar:jar to use <jar:jar> tag to create
multiple jars (just one in this case, but you can call <jar:jar> 
multiple times the postGoal).  Note that the jar:jar goal is called once
and all the lifecycle is preserved (eg the test prereqs).

Still - it is not ideal to duplicate the jar:jar goal functionality in 
the taglib.

What's the general feeling as to adding the a jar taglib to the jar 
plugin and have jar:jar goal use that?

Cheers, m.



Re: Issues on java and jar plugins

Posted by Rafal Krzewski <Ra...@caltha.pl>.
Mauro Talevi wrote:

> 2.  jar-plugin:  any reason why the <ant:jar> target in <jar:jar>
> does not allow the property ${maven.jar.includes}?
> How else, eg, is one supposed to create separate separate jars
> from a same codebase, when obviously related to the same project,
> as eg when wanting to put the RMI stubs in a separate jar?

General contract of Maven is that single project generates a single
artifact (a jar, war, or ear at this moment). There are many valid
real-life scenarios where this is not sufficient. The general Maven
practice is to create maven.xml hacks that bypass the contract.
What you are proposing would make these hacks a bit less obscure,
but does not change the overall situation.

The other thing is that attaining a goal multiple times with
different property values is not a recommended practice. The fact is
that it  is found in many places in maven does not make it "right".
It circumverts the concept of "goals" as such. Code reuse in plugins
should be performed using tag libraries. Tags can be invoked multiple
times and can take explicit parameters in addition to the properties
from the context. Some of the existing plugins were modified to
use this pattern, others were not.

I think that until the problem of single project -> multiple artifacts
scenario is solved, a good temporary solution would be factoring out
jar:jar goal code into a dynamic tag, so it can be used in the maven.xml
files in a cleaner way.

R.


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


Re: Issues on java and jar plugins

Posted by Juergen Heidak <Ju...@Heidak.de>.
Am Donnerstag, 24. April 2003 21:42 schrieb Mauro Talevi:
> A couple of issues:
>
> 1.  java-plugin:  would a java:compile-rmi goal be useful?
> It would simply wrap a call to <ant:rmic> but I find it so.
> I could send in a patch if needed.

1+

>
> 2.  jar-plugin:  any reason why the <ant:jar> target in <jar:jar>
> does not allow the property ${maven.jar.includes}?
> How else, eg, is one supposed to create separate separate jars
> from a same codebase, when obviously related to the same project,
> as eg when wanting to put the RMI stubs in a separate jar?
>
> It would be dead simple to add attribute
>        includes="${maven.jar.includes}"
> and have it default to include all.
>
> Another application would be separation of api/impl in a project.
> At present, you can override jar:jar by defining it in your maven.xml
> but I don't see any reason why it cannot be in the plugin.
>
> Trying to enforce good practice is one thing, but limiting equally
> good pratices is not good either.
>
> Comments welcome.
>
> Cheers, Mauro
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org


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