I've got a set of components I'm converting to build using Maven and am
wondering if anybody can improve on the way I've set it up at the moment.

At a simple level the 2 projects look like this:

<project>
        <id>tcw-core-utilities</id>
        <currentVersion>1.0</currentVersion>
</project>

<project>
        <id>tcw-core-apps</id>
        <currentVersion>1.0</currentVersion>
        <dependencies>
                <dependency>
                        <artifactId>tcw-core-utilities</artifactId>
                        <version>1.0</version>
                        <properties>
        
<eclipse.dependency>true</eclipse.dependency>
                        </properties>
                </dependency>
        </dependencies>
</project>


I've also got the following goal which uses the reactor to allow all
components to be built at the same time:

<goal name="all">
        <m:reactor basedir="${basedir}" includes="*/project.xml"
goals="${goals}" ignoreFailures="false"/>
</goal>


I've got the eclipse dependency property set up so it all builds as desired
when using eclipse (via the generated .project / .classpath), however the
basic Maven build doesn't work as cleanly as I'd hope.

The main issue is that when attaining a goal on the 2nd project
(tcw-core-apps) it references the version of the 1st project
(tcw-core-utilities) deployed to the local repository.  This differs to
what's happening in Eclipse, when it references whatever's in the classes
directory of the 1st project.

Why is this a problem?  There's a few scenarios I've seen where it's not so
intuitive:

1. Clean goal doesn't work without a previous deploy
Say on the above projects I bump both versions up to 1.1 and just want to
clean everything:
        
        maven all -Dgoals=clean

This fails because when we get to the 2nd project it tries to download
tcw-core-utilities-1.1.jar, which obviosuly hasn't been built yet.  But it's
clearly unneccessary for a clean, so if there's a way to set things up so
it's not downloaded in this case then that would be good.

2. Now suppose I compile all my projects:

        maven all -Dgoals=java:compile  (or indeed maven all
-Dgoals=jar:jar)

Again, the 2nd fails due to the non-existence of tcw-core-utilities-1.1.jar.
This does make sense in one regard, in that I've said I depend on 1.1 of
that library so it should try and download it.  But it would be nice if I
could just reference "the last build", similar to what Eclipse is doing.
Obviously I can get the desired behaviour by doing jar:install instead of
jar:jar, but it does mean that's a trap for the unwary and I'm trying to
make our build system as idiot proof as possible.

I did experiment with declaring the dependency in tcw-core-apps a SNAPSHOT
one, but pretty much hit the same issues, (the requirement was then to use
jar:install-snapshot)

Is there a better way, or is that just the way it is?

many thanks

James





------------------------------------------------------------------------
For more information about Barclays Capital, please
visit our web site at http://www.barcap.com.


Internet communications are not secure and therefore the Barclays 
Group does not accept legal responsibility for the contents of this 
message.  Although the Barclays Group operates anti-virus programmes, 
it does not accept responsibility for any damage whatsoever that is 
caused by viruses being passed.  Any views or opinions presented are 
solely those of the author and do not necessarily represent those of the 
Barclays Group.  Replies to this email may be monitored by the Barclays 
Group for operational or business reasons.

------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to