PR: MNG-869

Submitted by: Johnny R. Ruiz III
Reviewed by:  Brett Porter
compiler documentation

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@290902 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-09-22 07:16:50 +00:00
parent 54618af78b
commit 035c54d863
6 changed files with 125 additions and 6 deletions

View File

@ -106,6 +106,8 @@ public abstract class AbstractCompilerMojo
private int staleMillis;
/**
* The compiler id of the compiler to use.
*
* @parameter default-value="javac"
*/
private String compilerId;
@ -134,9 +136,9 @@ public abstract class AbstractCompilerMojo
private String executable;
/**
* Arguements to be passed to the compiler if fork is set to true.
* Arguments to be passed to the compiler if fork is set to true.
* <p/>
* This is because the list of valid arguements passed to a Java compiler
* This is because the list of valid arguments passed to a Java compiler
* varies based on the compiler version.
*
* @parameter
@ -165,7 +167,7 @@ public abstract class AbstractCompilerMojo
private File basedir;
/**
* The directory to run the compiler from if fork is true.
* The target directory of the compiler if fork is true.
*
* @parameter expression="${project.build.directory}"
* @required
@ -174,6 +176,8 @@ public abstract class AbstractCompilerMojo
private File buildDirectory;
/**
* Plexus compiler manager.
*
* @component
*/
private CompilerManager compilerManager;
@ -281,7 +285,7 @@ public abstract class AbstractCompilerMojo
canUpdateTarget = compiler.canUpdateTarget( compilerConfiguration );
if ( compiler.getCompilerOutputStyle().equals( CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES ) &&
!canUpdateTarget )
!canUpdateTarget )
{
getLog().info( "RESCANNING!" );
// TODO: This second scan for source files is sub-optimal

View File

@ -21,11 +21,11 @@ import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
import java.io.File;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.io.File;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
@ -39,6 +39,8 @@ public class CompilerMojo
extends AbstractCompilerMojo
{
/**
* The source directories containing the sources to be compiled.
*
* @parameter expression="${project.compileSourceRoots}"
* @required
* @readonly
@ -46,6 +48,8 @@ public class CompilerMojo
private List compileSourceRoots;
/**
* Project classpath.
*
* @parameter expression="${project.compileClasspathElements}"
* @required
* @readonly
@ -53,6 +57,8 @@ public class CompilerMojo
private List classpathElements;
/**
* The directory for compiled classes.
*
* @parameter expression="${project.build.outputDirectory}"
* @required
* @readonly
@ -60,6 +66,8 @@ public class CompilerMojo
private File outputDirectory;
/**
* Project artifacts.
*
* @parameter expression="${project.artifact}"
* @required
* @readonly
@ -69,12 +77,14 @@ public class CompilerMojo
/**
* A list of inclusion filters for the compiler.
*
* @parameter
*/
private Set includes = new HashSet();
/**
* A list of exclusion filters for the compiler.
*
* @parameter
*/
private Set excludes = new HashSet();

View File

@ -20,11 +20,11 @@ import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
import java.io.File;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.io.File;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@ -38,6 +38,8 @@ public class TestCompilerMojo
extends AbstractCompilerMojo
{
/**
* The source directories containing the test-source to be compiled.
*
* @parameter expression="${project.testCompileSourceRoots}"
* @required
* @readonly
@ -45,6 +47,8 @@ public class TestCompilerMojo
private List compileSourceRoots;
/**
* Project test classpath.
*
* @parameter expression="${project.testClasspathElements}"
* @required
* @readonly
@ -52,6 +56,8 @@ public class TestCompilerMojo
private List classpathElements;
/**
* The directory where compiled test classes go.
*
* @parameter expression="${project.build.testOutputDirectory}"
* @required
* @readonly
@ -60,12 +66,14 @@ public class TestCompilerMojo
/**
* A list of inclusion filters for the compiler.
*
* @parameter
*/
private Set testIncludes = new HashSet();
/**
* A list of exclusion filters for the compiler.
*
* @parameter
*/
private Set testExcludes = new HashSet();

View File

@ -0,0 +1,42 @@
------
Maven 2 Compiler Plugin
------
Johnny R. Ruiz III
<jruiz@exist.com>
------
September 19, 2005
How to Use
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 implementation="java.lang.String">**/*Point*.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
...
</build>
...
</project>
-------------------
There are other parameters that you can configure like fork, includes/include, debug, showWarnings etc.
For full documentation, click {{{index.html}here}}.

View File

@ -0,0 +1,14 @@
------
Maven 2 Compiler Plugin
------
Johnny R. Ruiz III
<jruiz@exist.com>
------
September 19, 2005
Introduction
This plugin is the Maven2 version of Maven1's Java Plugin.
This plugin provides the basic Javac facilities.

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project name="Maven Compiler Plugin">
<bannerLeft>
<name>Maven Compiler Plugin</name>
<src>http://maven.apache.org/images/apache-maven-project.png</src>
<href>http://maven.apache.org/</href>
</bannerLeft>
<bannerRight>
<src>http://maven.apache.org/images/maven-small.gif</src>
</bannerRight>
<body>
<links>
<item name="Maven 2" href="http://maven.apache.org/maven2/"/>
</links>
<menu name="Overview">
<item name="Introduction" href="introduction.html"/>
<item name="How to Use" href="howto.html"/>
</menu>
${reports}
</body>
</project>