You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Meikel <me...@meikel.at> on 2009/12/22 14:01:51 UTC

Question concerning maven-compiler-plugin

I created a minimal example maven project with the following directory
structure:

C:\SAMPLE.PRJ1
|   pom.xml
|
\---src
    \---main
        \---java
            \---sample
                     Client.java
                     Library.java

with the content of files Library.java and Client.java as shown below:

package sample;
public class Library {
	public int calcSum(int summand1, int summand2) {
		return summand1 + summand2;
	}
}

package sample;
public class Client {
	public Client() {
		Library lib = new Library();
		int result = lib.calcSum(1, 2);
		System.out.println(result);
	}
}

Obviously Client.java depends on Library.java because it calls method
calcSum() from inside the constructor. Now I do a "mvn compile" and both
classes are compiled to the target directory as I expect it. Now  I change
the signature of the method "calcSum()" in Library.java to

	public int calcSum(int summand1, int summand2, int summand3) {
	}

If the Client.java would be compiled against this Library.java this would
result in an compile error. But a call to "mvn compile" succeeds, because it
seems as only Library.java is compiled whereas Client.java is ignored.

My question is: what is the reason that the maven compiler plugin does not
recompile the Client.java in the scenario described above? It only
recompiles it if the Client.class is deleted, i.e. by calling "mvn clean
compile".

Regards,

Meikel



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


Re: Question concerning maven-compiler-plugin

Posted by Marat Radchenko <sl...@gmail.com>.
> My question is: what is the reason that the maven compiler plugin does not
> recompile the Client.java in the scenario described above? It only
> recompiles it if the Client.class is deleted, i.e. by calling "mvn clean
> compile".
That's the way javac works (and maven-compiler-plugin just invokes javac).

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