On 23 May 2012, at 1:59 AM, hujirong wrote:

> After working with Maven for a month, I am still not quite understand how
> Maven works. Maybe just like Microsoft technologies, encapsulate too much.
> One key issue is to understand the plugin.

The way to think of maven is:

"maven knows how to do stuff".

Most specifically, each bit of "stuff" that maven knows how to do is 
implemented by a plugin. For example, maven knows how to compile Java code 
using the "maven-compiler-plugin". There are a host of other plugins that kick 
in when you build, each one doing one thing, that runs one after the other as 
part of a maven lifecycle.

When you come to maven, don't ask the question "how do I...", instead ask the 
question "how does maven...". The reason the distinction is important is 
because maven already knows how to do something, you don't need to tell maven 
what to do, you just need to let maven get on with it.

The vast majority of maven plugins don't need any configuration at all, they 
just know what to do.

> For example, the following example, how can I see this thing allows JDK 5.0
> source. There is nowhere it says "allow". How do I know if it's not asking
> the compiler to use JDK 5.0?!

The mistake you're making is you're asking the question "how do I allow JDK 
source", so you're looking for an "allow" option and not finding one.

What you should ask instead is "how does maven control the JDK source", the 
answer is by the maven-compiler-plugin the minimum levels by setting the 
following configuration option in the configuration for the 
maven-compiler-plugin:

>      <configuration>
>        <source>1.5</source>
>        <target>1.5</target>
>      </configuration>

Regards,
Graham
--

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to