Re: reactor build changes in module recompilation of dependent modules

2012-07-04 Thread Dmitry Trunikov

Hi Wayne,

The app version is '1.0-SNAPSHOT'.
The Maven is:

$ mvn --version
Apache Maven 3.0.3 (r1075438; 2011-02-28 19:31:09+0200)
Maven home: /opt/maven
Java version: 1.6.0_29, vendor: Sun Microsystems Inc.
Java home: /opt/jdk1.6.0_29/jre
Default locale: en_US, platform encoding: UTF-8
OS name: linux, version: 3.2.0-25-generic, arch: amd64, family: unix

Below are the POMs which I use to reproduce the issue.
Directory structure:

pom.xml  [root pom, the builds were run in this dir]
|
+-api   [module of an interface]
|   |
|   +pom.xml
|
+-impl [module of an implementation]
|
+pom.xml


The root POM:

?xml version=1.0 encoding=UTF-8?
project xmlns=http://maven.apache.org/POM/4.0.0; 
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;


modelVersion4.0.0/modelVersion

groupIda.b.c/groupId
artifactIdfoo/artifactId
packagingpom/packaging
version1.0-SNAPSHOT/version

modules
moduleapi/module
moduleimpl/module
/modules

build
pluginManagement
plugins
plugin
artifactIdmaven-clean-plugin/artifactId
version2.4.1/version
/plugin
plugin
artifactIdmaven-resources-plugin/artifactId
version2.5/version
/plugin
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-compiler-plugin/artifactId
version2.4/version
configuration
source1.6/source
target1.6/target
/configuration
/plugin
/plugins
/pluginManagement
/build
/project


The POM for 'api' module:

?xml version=1.0 encoding=UTF-8?
project xmlns=http://maven.apache.org/POM/4.0.0; 
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;


modelVersion4.0.0/modelVersion

parent
groupIda.b.c/groupId
artifactIdfoo/artifactId
version1.0-SNAPSHOT/version
relativePath../relativePath
/parent

artifactIdfoo-api/artifactId
version1.0-SNAPSHOT/version
packagingjar/packaging

build
finalNamefoo-api/finalName
sourceDirectorysrc/main/java/sourceDirectory
/build

/project

The POM for 'impl' module:

?xml version=1.0 encoding=UTF-8?
project xmlns=http://maven.apache.org/POM/4.0.0; 
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;


modelVersion4.0.0/modelVersion

parent
groupIda.b.c/groupId
artifactIdfoo/artifactId
version1.0-SNAPSHOT/version
relativePath../relativePath
/parent

groupIda.b.c/groupId
artifactIdfoo-impl/artifactId
version1.0-SNAPSHOT/version
packagingjar/packaging

dependencies
dependency
groupIda.b.c/groupId
artifactIdfoo-api/artifactId
version1.0-SNAPSHOT/version
/dependency
/dependencies

build
finalNamefoo-impl/finalName
sourceDirectorysrc/main/java/sourceDirectory
/build

/project


Thanks for your help,

Dmitry



On 07/04/2012 12:15 AM, Wayne Fay wrote:

Question:

Why Maven didn't complain on second build?

What are the versions of the various projects in your build?

Wayne




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



Re: reactor build changes in module recompilation of dependent modules

2012-07-04 Thread Dmitry Trunikov


javac will only recompile classes that have changed. it does not do 
dependency analysis, so a breaking change will only cause a compile 
failure until you do clean




Thank you for clarification.
Is there any way (except explicit 'clean') to turn on dependency 
analysis during compilation.
The project consists of tens of modules so approach with 'clean' is not 
good enough because full re-biuld requires relative significant amount 
of time.


Thanks for your help,
Dmitry

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



Re: reactor build changes in module recompilation of dependent modules

2012-07-04 Thread Dmitry Trunikov


The way I do this is to use my IDE's dependency analysis to have my 
IDE do a Make (which rebuilds all the downstream changes)... then 
before I commit I will do a mvn clean verify to make sure that my 
changes are good




Yes my IDE does the analysis too.
The problem is in my colleague.
He is unix geek and orthodox and use Emacs as java IDE. At the start of 
the project we had a long discussion what use as build tool.
He insisted on Ant because he knew exactly how it works and can easily 
adjust build process.
I proposed to use Maven as it has perfect support of multi-module 
projects (at least I thought so at that time).
I frustrated a lot because in my opinion recompilation of dependent 
modules when dependency was changed is a main goal of any matured build 
tool.

And I was convinced that Maven reactor mechanism does it perfectly.
Actually I can't believe in absence of such functionality in Maven.


reactor build changes in module recompilation of dependent modules

2012-07-03 Thread Dmitry Trunikov

Hi All,

It seems that my question has an obvious answer. Unfortunately googling 
didn't give me a good one.


Prerequisites:

I have a classical multi-module project. The root POM declares two 
modules: 'api' and 'impl'.

These modules have references to the parent.
The module 'api' contains definition of an interface.
The module 'impl' has dependency on 'api' and a class which implements 
the interface.


Issue:

In the top directory I run a reactor build:

[First build]
$ mvn clean compile

The build finished with success.
Then I made changes in the interface declaration in the module 'api' 
(added a new method) and run build again:


[Second build]
$ mvn compile

The build finished with success again. It is strange because I expected 
that build finished with failure because class in the module 'impl' had 
no implementation of the method just added to the interface.

When I run build with command:

[Third build]
$ mvn clean compile

It finished, as I expected, with failure.

Question:

Why Maven didn't complain on second build?


Thanks for your help,

Dmitry