Do you specifically want to know about the compile plugin or plugin's
in general.

http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
might be a useful site to read.

When helping a new developer understand maven, below is what I go
though with them.

1) Understand maven's lifecycle
2) Understand maven's convention over configuration
3) Check the project package, to understand what lifecycle steps are
activated/used and what plugin's are enabled at each step.
4) Check what properties are active, check parent pom, properties
section, profiles section. I don't configure the compile plugin as the
example you have it just a longer version of setting the properties
maven.compiler.source and maven.compiler.target.
5) Check what plugins are activated, check plugins and
pluginManagement to see what plugin's are configured and what phase
they are configured to execute at. You will need to check the
currently pom and all parent pom's. i.e. our root project pom contains
all version numbers for dependencies, all plugin configuration, so a
sub pom just say use this dependency or plugin and overwrite any
properties as required.

Knowing what each plugin does and how to configure, does rely on those
developers producing accurate documentation and website.

Hope that helps, been using maven since feb 2005, so most things are
habbit now and trained/converted around a 100 developers now to see
the light...

Like Stephen said, the compiler example is just a way of passing the
right flags to javac. Instead of doing "javac -source 1.5 -target 1.6
...".

The plugin naming conversion should help you understand what the
plugin does, that is true for all org.apache.maven.plugins and also I
believe from codehaus, but the wider community can name it anything
they want

Take a made up plugin name called, worktidywrapper. I might have to do
one or more of the following to get it working as required, check the
plugin website if it exists, opening the jar, decompiling the code,
basic repeat execution till it doesn't fail. I might find out a better
name might be, maven-clear-old-snapshots-plugin. It might be a plugin
that removes old snapshots from your local repository because your
work laptop only has a 40GB hard disk and it keeps running out of
space, so they automated the process.

John

On 23 May 2012 01:25, Stephen Connolly <[email protected]> wrote:
> On Wednesday, 23 May 2012, hujirong wrote:
>
>> Hi
>>
>> 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.
>>
>> 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?!
>
>
> It is saying that the source code obeys 5.0 syntax and to generate byte
> code using 5.0 format.
>
> You can use any JDK >= 5.0 to build... But if using a JDK > 5.0 you will
> likely want to use animal sniffer to enforce the use of only JRE 5.0
> methods if you must be runtime compatible with 5.0 (which is EOL btw)
>
> Not really a Maven thing, more of a java thing
>
>>
>> So what shall I do to make me clearly understand how plugin in Maven work?
>>
>> Thanks
>> Jirong
>>
>> http://maven.apache.org/guides/getting-started/index.html
>>
>> For this example, we will configure the Java compiler to allow JDK 5.0
>> sources. This is as simple as adding this to your POM:
>>
>> ...
>> <build>
>>  <plugins>
>>    <plugin>
>>      <groupId>org.apache.maven.plugins</groupId>
>>      <artifactId>maven-compiler-plugin</artifactId>
>>      <version>2.0.2</version>
>>      <configuration>
>>        <source>1.5</source>
>>        <target>1.5</target>
>>      </configuration>
>>    </plugin>
>>  </plugins>
>> </build>
>> ...
>>
>>
>> --
>> View this message in context:
>> http://maven.40175.n5.nabble.com/Feel-Maven-is-not-intuitive-tp5709506.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected] <javascript:;>
>> For additional commands, e-mail: [email protected]<javascript:;>
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to