Skip to content

Commit

Permalink
[MJAVADOC-414] Artifacts missing from test classpath.
Browse files Browse the repository at this point in the history
 Patch of Michael Srb applied.


git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1666819 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
khmarbaise committed Mar 15, 2015
1 parent 8301c96 commit 3375b8b
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 0 deletions.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ under the License.
<pomInclude>MJAVADOC-365/pom.xml</pomInclude>
<pomInclude>MJAVADOC-369/pom.xml</pomInclude>
<pomInclude>MJAVADOC-407/pom.xml</pomInclude>
<pomInclude>MJAVADOC-414/pom.xml</pomInclude>
</pomIncludes>
</configuration>
</plugin>
Expand Down
18 changes: 18 additions & 0 deletions src/it/MJAVADOC-414/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.

invoker.goals=clean javadoc:test-javadoc
55 changes: 55 additions & 0 deletions src/it/MJAVADOC-414/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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="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/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
<artifactId>mjavadoc-414</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>@pom.version@</version>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>
30 changes: 30 additions & 0 deletions src/it/MJAVADOC-414/src/main/java/mjavadoc414/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package mjavadoc414;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

public class App
{

public void method()
{
System.out.println( "method() called." );
}

}
43 changes: 43 additions & 0 deletions src/it/MJAVADOC-414/src/test/java/mjavadoc414/test/AppTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package mjavadoc414.test;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import mjavadoc414.App;

public class AppTest extends TestCase
{

public AppTest( String testName )
{
super( testName );
}

/**
* Tests {@link mjavadoc414.App}.
*/
public void testApp()
{
new App().method();
}

}
47 changes: 47 additions & 0 deletions src/it/MJAVADOC-414/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

import java.io.*;
import org.codehaus.plexus.util.*;

File indexFile = new File( basedir, "target/site/testapidocs/mjavadoc414/test/AppTest.html" );

if ( !indexFile.exists() )
{
System.err.println( indexFile.getAbsolutePath() + " is missing." );
return false;
}

File buildLog = new File( basedir, "build.log" );
String content = IOUtil.toString( new FileInputStream( buildLog ) );
String importError = "error: cannot find symbol";
if ( content.contains( importError ) )
{
System.err.println( "build.log contains '" + importError + "'" );
return false;
}

String referenceWarning = "Tag @link: reference not found: mjavadoc414.App";
if ( content.contains( referenceWarning ) )
{
System.err.println( "build.log contains '" + referenceWarning + "'" );
return false;
}
return true;
Original file line number Diff line number Diff line change
Expand Up @@ -1751,6 +1751,16 @@ protected boolean isAggregator()
return false;
}

/**
* Indicates whether this goal generates documentation for the <code>Java Test code</code>.
*
* @return <code>true</code> if the goal generates Test Javadocs, <code>false</code> otherwise.
*/
protected boolean isTest()
{
return false;
}

/**
* @return the output directory
*/
Expand Down Expand Up @@ -2499,6 +2509,11 @@ private String getClasspath()
List<String> classpathElements = new ArrayList<String>();
Map<String, Artifact> compileArtifactMap = new HashMap<String, Artifact>();

if ( isTest() )
{
classpathElements.addAll( getProjectBuildOutputDirs( project ) );
}

populateCompileArtifactMap( compileArtifactMap, getProjectArtifacts( project ) );

if ( isAggregator() && project.isExecutionRoot() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,10 @@ protected SourceResolverConfig configureDependencySourceResolution( final Source
{
return super.configureDependencySourceResolution( config ).withoutCompileSources().withTestSources();
}

@Override
protected boolean isTest()
{
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,10 @@ protected SourceResolverConfig configureDependencySourceResolution( final Source
{
return super.configureDependencySourceResolution( config ).withoutCompileSources().withTestSources();
}

@Override
protected boolean isTest()
{
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,9 @@ protected File getJavadocDirectory()
return testJavadocDirectory;
}

@Override
protected boolean isTest()
{
return true;
}
}

0 comments on commit 3375b8b

Please sign in to comment.