Reputation: 5709
On a new project we are using maven. I have found a problem that we solved in ant by using the ant target depend
. The problem is that we have a class with public fields that are being referenced from other classes. If I remove one of these fields, the code should not compile, but it seems that all classes referencing it does not get compiled, though the specific class is compiled.
Does maven provide a similar function to ant depend, or are we doing something wrong?
Upvotes: 0
Views: 82
Reputation: 11470
As far as I know there is no ant depend
in maven. However the compile plugin should detect changes and recompile them. But maven compile is using javac and so it had the problems of not correctly finding all related changes (the same problem when you build your ant projects just with javac).
I did a test on a project using maven-compiler-plugin:2.3.2 and the problem occurs. However for me the problem disappears when I specify a newer compiler plugin in my pom:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
</plugin>
After that he compiles more classes and it works. Also you could try to use an other compiler as javac which is more suitable for incremental builds like the eclipse one see non javac compiler docu.
For release builds I always suggest to use mvn clean package
so you can be sure the project is compiled completely and is not suffering from out of date files.
Update:
I also found the error MCOMPILER-160 which could be related to my problem since I was using the 2.3.2 version. So maybe you check your compiler version too.
Upvotes: 2