Author: epunzalan Date: Thu Jul 6 00:04:01 2006 New Revision: 419472 URL: http://svn.apache.org/viewvc?rev=419472&view=rev Log: PR: MCOMPILER-38
Added plugin documentations for review Added: maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/ maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/compile_using_different_jdk.apt maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/compile_with_memory_enhancements.apt maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/pass_compiler_arguments.apt maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/set_compiler_source_and_target.apt maven/plugins/trunk/maven-compiler-plugin/src/site/apt/index.apt maven/plugins/trunk/maven-compiler-plugin/src/site/apt/usage.apt (contents, props changed) - copied, changed from r419166, maven/plugins/trunk/maven-compiler-plugin/src/site/apt/howto.apt maven/plugins/trunk/maven-compiler-plugin/src/site/fml/ maven/plugins/trunk/maven-compiler-plugin/src/site/fml/faq.fml Removed: maven/plugins/trunk/maven-compiler-plugin/src/site/apt/howto.apt Modified: maven/plugins/trunk/maven-compiler-plugin/pom.xml maven/plugins/trunk/maven-compiler-plugin/src/site/site.xml Modified: maven/plugins/trunk/maven-compiler-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/pom.xml?rev=419472&r1=419471&r2=419472&view=diff ============================================================================== --- maven/plugins/trunk/maven-compiler-plugin/pom.xml (original) +++ maven/plugins/trunk/maven-compiler-plugin/pom.xml Thu Jul 6 00:04:01 2006 @@ -1,8 +1,10 @@ -<project> +<?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/maven-v4_0_0.xsd"> <parent> <artifactId>maven-plugins</artifactId> <groupId>org.apache.maven.plugins</groupId> - <version>1</version> + <version>2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>maven-compiler-plugin</artifactId> @@ -10,6 +12,9 @@ <name>Maven Compiler Plugin</name> <version>2.1-SNAPSHOT</version> <inceptionYear>2001</inceptionYear> + <prerequisites> + <maven>2.0</maven> + </prerequisites> <dependencies> <dependency> <groupId>org.apache.maven</groupId> @@ -49,4 +54,12 @@ <scope>test</scope> </dependency> </dependencies> + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-changelog-plugin</artifactId> + </plugin> + </plugins> + </reporting> </project> Added: maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/compile_using_different_jdk.apt URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/compile_using_different_jdk.apt?rev=419472&view=auto ============================================================================== --- maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/compile_using_different_jdk.apt (added) +++ maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/compile_using_different_jdk.apt Thu Jul 6 00:04:01 2006 @@ -0,0 +1,36 @@ + ------ + Maven Compiler Plugin Example + ------ + Edwin Punzalan + ------ + 05 July 2006 + ------ + +Compiling Sources Using A Different JDK + + The <<<compilerVersion>>> parameter can be used to specify the version of the + compiler that the plugin will use. However, you also need to set <<<fork>>> + to <<<true>>> for this to work. For example: + ++------- +<project> + [...] + <build> + [...] + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <verbose>true</verbose> + <fork>true</fork> + <executable><!-- path-to-javac --></executable> + <compilerVersion>1.3</compilerVersion> + </configuration> + </plugin> + </plugins> + [...] + </build> + [...] +</project> ++------- \ No newline at end of file Added: maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/compile_with_memory_enhancements.apt URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/compile_with_memory_enhancements.apt?rev=419472&view=auto ============================================================================== --- maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/compile_with_memory_enhancements.apt (added) +++ maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/compile_with_memory_enhancements.apt Thu Jul 6 00:04:01 2006 @@ -0,0 +1,34 @@ + ------ + Maven Compiler Plugin Example + ------ + Edwin Punzalan + ------ + 05 July 2006 + ------ + +Preventing <<<OutOfMemory>>> problems during compilation + + The Compiler Plugin accepts configurations for <<<meminitial>>> and + <<<maxmem>>>. You can follow the example below to set the initial memory + size to 128MB and the maximum memory usage to 512MB: + ++----- +<project> + [...] + <build> + [...] + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <meminitial>128</meminitial> + <maxmem>512</maxmem> + </configuration> + </plugin> + </plugins> + [...] + </build> + [...] +</project> ++----- \ No newline at end of file Added: maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/pass_compiler_arguments.apt URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/pass_compiler_arguments.apt?rev=419472&view=auto ============================================================================== --- maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/pass_compiler_arguments.apt (added) +++ maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/pass_compiler_arguments.apt Thu Jul 6 00:04:01 2006 @@ -0,0 +1,35 @@ + ------ + Maven Compiler Plugin Example + ------ + Edwin Punzalan + ------ + 05 July 2006 + ------ + +Passing Compiler Arguments Using the Compiler Plugin + + Sometimes, you need to pass other compiler arguments that are not handled by + the Compiler Plugin itself but is supported by the <<<compilerId>>> selected. + For such arguments, the Compiler Plugin's <<<compilerArguments>>> will be + used. The following example passes compiler arguments to the <<<javac>>> + compiler: + ++----- +<project> + [...] + <build> + [...] + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <compilerArguments>-verbose -nowarn</compilerArguments> + </configuration> + </plugin> + </plugins> + [...] + </build> + [...] +</project> ++----- \ No newline at end of file Added: maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/set_compiler_source_and_target.apt URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/set_compiler_source_and_target.apt?rev=419472&view=auto ============================================================================== --- maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/set_compiler_source_and_target.apt (added) +++ maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/set_compiler_source_and_target.apt Thu Jul 6 00:04:01 2006 @@ -0,0 +1,38 @@ + ------ + Maven Compiler Plugin Example + ------ + Edwin Punzalan + ------ + 05 July 2006 + ------ + +Setting the <<<-source>>> and <<<-target>>> of the Java Compiler + + Sometimes when you may need to compile a certain project to a different + version than what you are currently using. The <<<javac>>> can accept + such command using <<<-source>>> and <<<-target>>>. The Compiler Plugin + can also be configured to provide these options during compilation. + + For example, you are using JDK 1.5 and want your compiled classes to be + compatible with JDK 1.3, you can then put: + ++----- +<project> + [...] + <build> + [...] + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.3</target> + </configuration> + </plugin> + </plugins> + [...] + </build> + [...] +</project> ++----- \ No newline at end of file Added: maven/plugins/trunk/maven-compiler-plugin/src/site/apt/index.apt URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/site/apt/index.apt?rev=419472&view=auto ============================================================================== --- maven/plugins/trunk/maven-compiler-plugin/src/site/apt/index.apt (added) +++ maven/plugins/trunk/maven-compiler-plugin/src/site/apt/index.apt Thu Jul 6 00:04:01 2006 @@ -0,0 +1,46 @@ + ------ + Maven Compiler Plugin: Overview + ------ + Edwin Punzalan + ------ + 06 July 2006 + ------ + + +Maven Compiler Plugin + + The Compiler Plugin is used to compile the sources of your project. The + default compiler is <<<javac>>> and is used to compile Java sources. Other + compilers can be used and work has already started on AspectJ, .NET, and C#. + + This Compiler Plugin is Maven 2 version of Maven 1.x's Java Plugin. + +* Goals Overview + + The Compiler Plugin has two goals. Both are already bound to their proper + phases within the Maven Lifecycles and are therefore, automatically executed + during their respective phases. + + * {{{compile-mojo.html}compiler:compile}} is bound to the compile phase and + is used to compile the main source files. + + * {{{testCompile-mojo.html}compiler:testCompile}} is bound to the + test-compile phase and is used to compile the test source files. + +* How To Use + + Instructions on how to use the Compiler Plugin can be found + {{{usage.html}here}}. + +* Examples + + To provide you with better understanding on some usages of the Compiler + Plugin, you can take a look into the following examples: + + * {{{examples/compile_using_different_jdk.html}Compile Using A Different JDK}} + + * {{{examples/set_compiler_source_and_target.html}Compile Using -source and -target javac Options}} + + * {{{examples/compile_with_memory_enhancements.html}Compile Using Memory Allocation Enhancement}} + + * {{{examples/pass_compiler_arguments.html}Pass Compiler Arguments Using The Compiler Plugin}} Copied: maven/plugins/trunk/maven-compiler-plugin/src/site/apt/usage.apt (from r419166, maven/plugins/trunk/maven-compiler-plugin/src/site/apt/howto.apt) URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/site/apt/usage.apt?p2=maven/plugins/trunk/maven-compiler-plugin/src/site/apt/usage.apt&p1=maven/plugins/trunk/maven-compiler-plugin/src/site/apt/howto.apt&r1=419166&r2=419472&rev=419472&view=diff ============================================================================== --- maven/plugins/trunk/maven-compiler-plugin/src/site/apt/howto.apt (original) +++ maven/plugins/trunk/maven-compiler-plugin/src/site/apt/usage.apt Thu Jul 6 00:04:01 2006 @@ -1,50 +1,38 @@ ------ - Maven 2 Compiler Plugin + Maven 2 Compiler Plugin: Usage ------ - Johnny R. Ruiz III - <[EMAIL PROTECTED]> + Edwin Punzalan ------ - September 19, 2005 + 05 July 2006 -How to Use +Maven 2 Compiler Plugin: Usage - These example shows how to set the -source and -target argument of the Java Compiler. - - It also shows how to exclude certain files on the items to be compiled. - -------------------- -<project> - ... - <build> - ... - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.5</source> - <target>1.5</target> - <excludes> - <exclude>**/*Point*.java</exclude> - </excludes> - </configuration> - </plugin> - </plugins> - ... - </build> - ... -</project> -------------------- +* Compiling Your Java Sources + + The goals for the Compiler Plugin are bound to their respective phases in the + build lifecycle. So to compile your sources, you need only to tell maven + until which lifecycle to execute. The following will compile your sources: + ++----- +mvn compile ++----- + + To compile your test sources, you'll do: + ++----- +mvn test-compile ++----- -Compiling in JDKs other than the used to run Maven + The above command will execute both <<<compiler:compile>>> and + <<<compiler:test-compile>>> since the compile phase happens a few phases + before the test-compile phase. - You can use any JDK to compile, not only the one used to run Maven. +* Configuring Your Compiler Plugin - Note that this is different than just building with source and target options, - this option actaully uses a different JDK, while with sources and target you just - set the compatability version of the compiled classes. + Since the Compiler Plugin executes automatically during their phases, you + don't have to put <<<executions>>> unlike the other plugins. -------------------- ++----- <project> ... <build> @@ -53,17 +41,11 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> - <fork>true</fork> - <compilerVersion>1.3</compilerVersion> - <executable>C:/Program Files/Java/jdk1.3.1_18/bin/javac</executable> - <!-- - A portable way using environment variables - <executable>${JAVA_1_3_HOME}/bin/javac</executable> - --> + <!-- put your configurations here --> </configuration> </plugin> </plugins> </build> ... </project> -------------------- ++----- Propchange: maven/plugins/trunk/maven-compiler-plugin/src/site/apt/usage.apt ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-compiler-plugin/src/site/apt/usage.apt ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/plugins/trunk/maven-compiler-plugin/src/site/fml/faq.fml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/site/fml/faq.fml?rev=419472&view=auto ============================================================================== --- maven/plugins/trunk/maven-compiler-plugin/src/site/fml/faq.fml (added) +++ maven/plugins/trunk/maven-compiler-plugin/src/site/fml/faq.fml Thu Jul 6 00:04:01 2006 @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<faqs id="FAQ" title="Frequently Asked Questions"> + <part id="General"> + <faq id="compile-error-reports"> + <question>Is there a way to get Maven to report the number of compile errors found?</question> + <answer> + <p> + Currently, this type of summary information is not built into the compiler plugin, but it + would be possible to add. If this feature is important to you, add your vote to + <a href="http://jira.codehaus.org/browse/MNG-1854">MNG-1854</a>. + </p> + </answer> + </faq> + <faq id="how-to-add-generated-sources"> + <question>How do I add my generated sources to the compile path of Maven, when using modello?</question> + <answer> + <p>Modello generate the sources in the generate-sources phase and automatically adds the + source directory for compilation in maven. So you don't have to copy the generated sources.</p> + <p>You have to declare the modello-plugin in the build of your plugin for source generation + (in that way the sources are generated each time).</p> + </answer> + </faq> + </part> +</faqs> \ No newline at end of file Modified: maven/plugins/trunk/maven-compiler-plugin/src/site/site.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/site/site.xml?rev=419472&r1=419471&r2=419472&view=diff ============================================================================== --- maven/plugins/trunk/maven-compiler-plugin/src/site/site.xml (original) +++ maven/plugins/trunk/maven-compiler-plugin/src/site/site.xml Thu Jul 6 00:04:01 2006 @@ -33,9 +33,19 @@ </links> <menu name="Overview"> - <item name="Introduction" href="introduction.html"/> - <item name="How to Use" href="howto.html"/> + <item name="How to Use" href="usage.html"/> + <item name="FAQ" href="faq.html"/> </menu> + + <menu name="Examples"> + <item name="Compile Using A Different JDK" href="examples/compile_using_different_jdk.html"/> + <item name="Compile Using -source and -target javac Options" href="examples/set_compiler_source_and_target.html"/> + <item name="Compile Using Memory Allocation Enhancements" href="examples/compile_with_memory_enhancements.html"/> + <item name="Pass Compiler Arguments Using The Compiler Plugin" href="examples/pass_compiler_arguments.html"/> + + </menu> + ${reports} + </body> </project>