Make a report with compiler output

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@291230 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
carlos
2005-09-24 00:41:01 +00:00
parent f62392ae8f
commit 80ad091328
7 changed files with 124 additions and 2 deletions

View File

@@ -22,7 +22,9 @@
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:define="jelly:define"
xmlns:maven="jelly:maven">
xmlns:maven="jelly:maven"
xmlns:doc="doc"
xmlns:util="jelly:util">
<!-- ================================================================== -->
<!-- P R E P A R E F I L E S Y S T E M -->
@@ -55,6 +57,15 @@
</ant:echo>
</j:if>
<!-- start capturing compiler output -->
<j:if test="${context.getVariable('maven.compile.fork')}">
<ant:record name="${maven.compile.log}"
action="start"
loglevel="warning"
emacsmode="true"
append="no"/>
</j:if>
<ant:javac
destdir="${maven.build.dest}"
excludes="**/package.html"
@@ -138,6 +149,12 @@
</ant:javac>
<j:if test="${context.getVariable('maven.compile.fork')}">
<ant:record name="${maven.compile.log}"
action="stop"/>
</j:if>
</j:when>
<j:otherwise>
<ant:echo>No java source files to compile.</ant:echo>
@@ -171,4 +188,60 @@
<echo>DEPRECATED: the use of dependency-handle is deprecated. Please use maven:get/set to modify properties of the java plugin</echo>
</define:tag>
</define:taglib>
<!-- ================================================================== -->
<!-- J A V A R E P O R T S -->
<!-- ================================================================== -->
<goal name="maven-java-plugin:register" prereqs="xdoc:init">
<doc:registerReport
name="Compiler output Report"
pluginName="maven-java-plugin"
link="java-compiler-output-report"
description="Formatted report of compiler output"
/>
</goal>
<goal name="maven-java-plugin:deregister">
<doc:deregisterReport name="Compiler output Report"/>
</goal>
<!-- ================================================================== -->
<!-- J A V A -->
<!-- ================================================================== -->
<goal name="maven-java-plugin:report"
description="Generate compiler output report" prereqs="java:compile,xdoc:init">
<j:set var="genDocs" value="${maven.gen.docs}" />
<!-- if the deprecation log file is not present, then create it. -->
<j:set var="logAvailable" value="false"/>
<util:available file="${maven.compile.log}">
<j:set var="logAvailable" value="true"/>
</util:available>
<j:if test="${!logAvailable}">
<ant:fail>
The compiler output log file ${maven.compile.log} could not be found. Did you set maven.compile.fork to true?
</ant:fail>
</j:if>
<util:file name="${maven.compile.log}" var="inputFileObject"/>
<util:loadText var="inputText" file="${inputFileObject}"/>
<!-- trim path to basedir/ -->
<j:set var="pathToTrim">${basedir}${file.separator}</j:set>
<j:invokeStatic var="inputText" className="org.apache.commons.lang.StringUtils" method="replace">
<j:arg type="java.lang.String" value="${inputText}" />
<j:arg type="java.lang.String" value="${pathToTrim}" />
<j:arg type="java.lang.String" value="" />
</j:invokeStatic>
<doc:text-xdoc
title="Compiler output Report"
section="Compiler output Report"
inputText="${inputText}"
output="${genDocs}/java-compiler-output-report.xml"/>
</goal>
</project>

View File

@@ -17,3 +17,5 @@
# -------------------------------------------------------------------
# P L U G I N P R O P E R T I E S
# -------------------------------------------------------------------
maven.compile.log=${maven.build.dir}/compile.log

View File

@@ -21,7 +21,7 @@
<pomVersion>3</pomVersion>
<id>maven-java-plugin</id>
<name>Maven Java Plug-in</name>
<currentVersion>1.5</currentVersion>
<currentVersion>1.6-SNAPSHOT</currentVersion>
<description/>
<shortDescription>Compile java code</shortDescription>
<url>http://maven.apache.org/reference/plugins/java/</url>
@@ -97,4 +97,11 @@
</roles>
</developer>
</developers>
<contributors>
<contributor>
<name>Ron Gallagher</name>
<email>rongallagher@bellsouth.net</email>
<organization>RGI</organization>
</contributor>
</contributors>
</project>

View File

@@ -25,6 +25,9 @@
<author email="kschrader@karmalab.org">Kurt Schrader</author>
</properties>
<body>
<release version="1.6-SNAPSHOT" date="in SVN">
<action dev="carlos" type="add" issue="MPJAVA-40" due-to="Ron Gallagher">Make a report with compiler output</action>
</release>
<release version="1.5" date="2004-12-04">
<action dev="vmassol" type="fix" issue="MPJAVA-22">Make it work by default with any version of the JDK</action>
<action dev="brett" type="update">Deprecate dependency handle</action>

View File

@@ -59,6 +59,30 @@
</p>
</td>
</tr>
<tr>
<td>maven-java-plugin:register</td>
<td>
<p>
Register the java compiler output report.
</p>
</td>
</tr>
<tr>
<td>maven-java-plugin:deregister</td>
<td>
<p>
Deregister the java compiler output report.
</p>
</td>
</tr>
<tr>
<td>maven-java-plugin:report</td>
<td>
<p>
Generate the java compiler output report.
</p>
</td>
</tr>
<tr>
<td>java:jar</td>
<td>

View File

@@ -38,6 +38,11 @@
by this plugin, please see the <a href="properties.html">properties</a>
document.
</p>
<p>
You can get a report from the compiler output adding
<code>maven-java-plugin</code> to the reports section of your pom.
(note that you need to set to true <code>maven.compile.fork</code>)
</p>
</section>
</body>
</document>

View File

@@ -194,6 +194,14 @@
</p>
</td>
</tr>
<tr>
<td>maven.compile.log</td>
<td>Yes</td>
<td>
<p>Where to save the output of the compiler. Only works when fork is true.</p>
<p>The default value for this property is ${maven.build.dir}/compile.log</p>
</td>
</tr>
<tr>
<td>pom.build.sourceModifications</td>
<td>Yes</td>