MPJAVADOC-36 : fix error when the package isn't defined in the POM.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115905 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4798976b98
commit
8efbf7a9fe
@ -79,6 +79,10 @@ maven.javadoc.useexternalfile = [${maven.javadoc.useexternalfile}]
|
||||
maven.javadoc.version = [${maven.javadoc.version}]
|
||||
maven.javadoc.windowtitle = [${maven.javadoc.windowtitle}]
|
||||
==================================
|
||||
=== Project descriptor ===
|
||||
==================================
|
||||
pom.package = [${pom.package}]
|
||||
==================================
|
||||
=== javadoc internal variables ===
|
||||
==================================
|
||||
internal.javadoc.jar = [${internal.javadoc.jar}]
|
||||
@ -105,7 +109,7 @@ internal.javadoc.working.dir = [${internal.javadoc.working.dir}]
|
||||
<j:otherwise>
|
||||
|
||||
<!-- test if sourceModifications are defined -->
|
||||
<j:if test="${pom.build.sourceModifications!=null && !pom.build.sourceModifications.isEmpty()}">
|
||||
<j:if test="${pom.build.sourceModifications!=null and !pom.build.sourceModifications.isEmpty()}">
|
||||
<j:if test="${maven.javadoc.debug}"><ant:echo>sourceModifications used.</ant:echo></j:if>
|
||||
<util:tokenize var="sources.dirs" delim="${path.separator}">${context.getAntProject().getReferences().get('maven.compile.src.set')}</util:tokenize>
|
||||
<ant:copy todir="${internal.javadoc.src.tmp}">
|
||||
@ -148,11 +152,13 @@ internal.javadoc.working.dir = [${internal.javadoc.working.dir}]
|
||||
<!-- If we have not already find sources -->
|
||||
<j:if test="${internal.javadoc.needed != true}">
|
||||
<!-- We construct the fileset -->
|
||||
<j:set var="includes" value="**/*.java" />
|
||||
<util:replace var="packageDir" newChar="/" oldChar="." value="${pom.package}" />
|
||||
<j:if test="${!empty(packageDir)}">
|
||||
<j:set var="includes" value="${packageDir}/**/*.java" />
|
||||
</j:if>
|
||||
<j:if test="${empty(packageDir)}">
|
||||
<j:set var="includes" value="**/*.java" />
|
||||
</j:if>
|
||||
<ant:fileScanner var="sources">
|
||||
<ant:fileset dir="${dir}">
|
||||
<ant:include name="${includes}" />
|
||||
@ -269,9 +275,18 @@ internal.javadoc.working.dir = [${internal.javadoc.working.dir}]
|
||||
|
||||
<ant:mkdir dir="${internal.javadoc.working.dir}" />
|
||||
<ant:record name="${internal.javadoc.working.dir}/report.txt" action="start" />
|
||||
|
||||
<j:choose>
|
||||
<j:when test="${pom.package != null and !pom.package.equals('')}">
|
||||
<j:set var="packageNamesValue" value="${pom.package}.*" />
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<j:set var="packageNamesValue" value="*" />
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
<ant:javadoc
|
||||
packagenames="${pom.package}.*"
|
||||
packagenames="${packageNamesValue}"
|
||||
destdir="${maven.javadoc.destdir}"
|
||||
author="${maven.javadoc.author}"
|
||||
public="${maven.javadoc.public}"
|
||||
@ -291,7 +306,7 @@ internal.javadoc.working.dir = [${internal.javadoc.working.dir}]
|
||||
<ant:sourcepath>
|
||||
<ant:path refid="internal.javadoc.sources"/>
|
||||
</ant:sourcepath>
|
||||
|
||||
|
||||
<j:if test="${context.getVariable('maven.javadoc.source') != null}">
|
||||
<ant:setProperty name="source" value="${maven.javadoc.source}" />
|
||||
</j:if>
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>maven-javadoc-plugin</id>
|
||||
<name>Maven Javadoc Plug-in</name>
|
||||
<currentVersion>1.6.1</currentVersion>
|
||||
<currentVersion>1.7-SNAPSHOT</currentVersion>
|
||||
<description/>
|
||||
<shortDescription>Produce Javadocs and report</shortDescription>
|
||||
<url>http://maven.apache.org/reference/plugins/javadoc/</url>
|
||||
@ -87,7 +87,6 @@
|
||||
<organization>Zenplex</organization>
|
||||
<roles>
|
||||
<role>Architect</role>
|
||||
<role>Release Manager</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
@ -114,6 +113,7 @@
|
||||
<email>aheritier@apache.org</email>
|
||||
<roles>
|
||||
<role>Developer</role>
|
||||
<role>Release Manager</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
5
javadoc/src/plugin-test/test05/.cvsignore
Normal file
5
javadoc/src/plugin-test/test05/.cvsignore
Normal file
@ -0,0 +1,5 @@
|
||||
gump.xml
|
||||
*.log
|
||||
targetdist
|
||||
dist
|
||||
target
|
||||
39
javadoc/src/plugin-test/test05/maven.xml
Normal file
39
javadoc/src/plugin-test/test05/maven.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2001-2004 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 xmlns:util="jelly:util"
|
||||
xmlns:maven="jelly:maven"
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:assert="assert"
|
||||
xmlns:ant="jelly:ant">
|
||||
|
||||
<goal name="testPlugin">
|
||||
<delete dir="${maven.build.dir}" failonerror="false"/>
|
||||
<delete file="${maven.build.dir}/${maven.final.name}_javadoc.jar" failonerror="false"/>
|
||||
<attainGoal name="javadoc"/>
|
||||
<assert:assertFileExists file="${maven.javadoc.destdir}/index.html"/>
|
||||
<!-- assert that doc-files are copied - Issue MPJAVADOC-24 -->
|
||||
<!-- Doesn't work actually in this case :-( -->
|
||||
<!-- <assert:assertFileExists file="${maven.javadoc.destdir}/test/doc-files/example.txt"/> -->
|
||||
<!-- assert that javadoc for classes Dummy, Dummy2, Dummy3 are generated -->
|
||||
<!-- Doesn't work actually in this case :-( -->
|
||||
<!-- <assert:assertFileExists file="${maven.javadoc.destdir}/Dummy.html"/> -->
|
||||
<!-- <assert:assertFileExists file="${maven.javadoc.destdir}/Dummy2.html"/> -->
|
||||
<assert:assertFileExists file="${maven.javadoc.destdir}/test/Dummy3.html"/>
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
65
javadoc/src/plugin-test/test05/project.xml
Normal file
65
javadoc/src/plugin-test/test05/project.xml
Normal file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2001-2004 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>
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>test-maven-javadoc-plugin-05</id>
|
||||
<name>Generates the Javadoc for a project without package in POM (MPJAVADOC-36)</name>
|
||||
<groupId>maven</groupId>
|
||||
<currentVersion>1.0-SNAPSHOT</currentVersion>
|
||||
<organization>
|
||||
<name>Apache Software Foundation</name>
|
||||
<url>http://www.apache.org/</url>
|
||||
<logo>http://maven.apache.org/images/apache-maven-project.png</logo>
|
||||
</organization>
|
||||
<inceptionYear>2001</inceptionYear>
|
||||
<logo>http://maven.apache.org/images/maven.jpg</logo>
|
||||
<description>Generates the Javadoc for a project without package in POM (MPJAVADOC-36)</description>
|
||||
<shortDescription>Generates the Javadoc for a project without package in POM (MPJAVADOC-36)</shortDescription>
|
||||
<url>http://maven.apache.org/reference/plugins/javadoc/index.html</url>
|
||||
<siteDirectory>/www/maven.apache.org/reference/plugins/javadoc/</siteDirectory>
|
||||
<repository>
|
||||
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-plugins/javadoc/</connection>
|
||||
<url>http://cvs.apache.org/viewcvs/maven-plugins/javadoc/</url>
|
||||
</repository>
|
||||
<developers>
|
||||
<developer>
|
||||
<name>dIon Gillard</name>
|
||||
<id>dion</id>
|
||||
<email>dion@multitask.com.au</email>
|
||||
<organization>Multitask Consulting</organization>
|
||||
<roles>
|
||||
<role>Documentation</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Arnaud Heritier</name>
|
||||
<id>aheritier</id>
|
||||
<email>aheritier@apache.org</email>
|
||||
<roles>
|
||||
<role>Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src/main</sourceDirectory>
|
||||
</build>
|
||||
</project>
|
||||
6
javadoc/src/plugin-test/test05/src/main/Dummy.java
Normal file
6
javadoc/src/plugin-test/test05/src/main/Dummy.java
Normal file
@ -0,0 +1,6 @@
|
||||
public class Dummy
|
||||
{
|
||||
public String badChecky = "error";
|
||||
|
||||
public Dummy() {}
|
||||
}
|
||||
6
javadoc/src/plugin-test/test05/src/main/Dummy2.java
Normal file
6
javadoc/src/plugin-test/test05/src/main/Dummy2.java
Normal file
@ -0,0 +1,6 @@
|
||||
public class Dummy2
|
||||
{
|
||||
public String badChecky = "error";
|
||||
|
||||
public Dummy dummy = new Dummy();
|
||||
}
|
||||
8
javadoc/src/plugin-test/test05/src/main/test/Dummy3.java
Normal file
8
javadoc/src/plugin-test/test05/src/main/test/Dummy3.java
Normal file
@ -0,0 +1,8 @@
|
||||
package test;
|
||||
|
||||
public class Dummy3
|
||||
{
|
||||
public String badChecky = "error";
|
||||
|
||||
public Dummy3 dummy = new Dummy3();
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
This an example
|
||||
@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
Package documentation. <br/>
|
||||
<a href="doc-files/example.txt">example.txt</a> in doc-files directory.
|
||||
</body>
|
||||
</html>
|
||||
@ -25,6 +25,10 @@
|
||||
<author email="evenisse@ifrance.com">Emmanuel Venisse</author>
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.7" date="In CVS">
|
||||
<action dev="aheritier" type="fix" issue="MPJAVADOC-37">Default javadoc scope (package) can't be replaced by private or public.</action>
|
||||
<action dev="aheritier" type="fix" issue="MPJAVADOC-36">Javadoc fails if pom.package isn't specified.</action>
|
||||
</release>
|
||||
<release version="1.6.1" date="2004-07-13">
|
||||
<action dev="brett" type="fix">Correct check needed function for when package is given but there are not java files in it.</action>
|
||||
</release>
|
||||
|
||||
@ -316,17 +316,27 @@ maven.javadoc.offlineLinks=http://java.sun.com/j2se/1.4.2/docs/api/#/opt/java-ap
|
||||
<section name="Other Settings">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property</th>
|
||||
<th>Type</th>
|
||||
<th>Name</th>
|
||||
<th>Optional?</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Property</td>
|
||||
<td>maven.compile.encoding</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Sets the encoding of the .java files being documented (and compiled).
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Project descriptor</td>
|
||||
<td>pom.package</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
The package used as root for the javadoc.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user