diff --git a/maven-jxr-plugin/pom.xml b/maven-jxr-plugin/pom.xml
index 78e04bfe..38081b60 100644
--- a/maven-jxr-plugin/pom.xml
+++ b/maven-jxr-plugin/pom.xml
@@ -38,8 +38,10 @@ under the License.
- 3.2.5
- 1.0.0.v20140518
+ 3.6.3
+ 1.4.1
+
+ 3.5.3
@@ -82,18 +84,17 @@ under the License.
org.apache.maven.wagon
wagon-provider-api
- 2.8
-
+ ${wagonVersion}
org.apache.maven.reporting
maven-reporting-api
- 3.1.1
+ 4.0.0-M12
org.apache.maven.reporting
maven-reporting-impl
- 3.2.0
+ 4.0.0-M15
@@ -130,33 +131,33 @@ under the License.
- org.eclipse.aether
- aether-api
- ${aetherVersion}
+ org.apache.maven.resolver
+ maven-resolver-api
+ ${resolverVersion}
test
- org.eclipse.aether
- aether-impl
- ${aetherVersion}
+ org.apache.maven.resolver
+ maven-resolver-impl
+ ${resolverVersion}
test
- org.eclipse.aether
- aether-connector-basic
- ${aetherVersion}
+ org.apache.maven.resolver
+ maven-resolver-connector-basic
+ ${resolverVersion}
test
- org.eclipse.aether
- aether-transport-wagon
- ${aetherVersion}
+ org.apache.maven.resolver
+ maven-resolver-transport-wagon
+ ${resolverVersion}
test
org.apache.maven.wagon
wagon-http-lightweight
- 3.5.1
+ ${wagonVersion}
test
diff --git a/maven-jxr-plugin/src/it/JXR-100_parameterlink/verify.groovy b/maven-jxr-plugin/src/it/JXR-100_parameterlink/verify.groovy
index e9591331..383a19b4 100644
--- a/maven-jxr-plugin/src/it/JXR-100_parameterlink/verify.groovy
+++ b/maven-jxr-plugin/src/it/JXR-100_parameterlink/verify.groovy
@@ -16,6 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-assert new File( basedir, 'target/site/xref/com/mycompany/app/Foo.html' ).exists()
+File file = new File( basedir, 'target/reports/xref/com/mycompany/app/Foo.html' );
-assert 4 == new File( basedir, '/target/site/xref/com/mycompany/app/Foo.html' ).text.count( 'App' )
+assert file.exists()
+
+assert 4 == file.text.count( 'App' )
diff --git a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java
index 569773a7..108c41c4 100644
--- a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java
+++ b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java
@@ -37,6 +37,7 @@
import org.apache.maven.jxr.pacman.FileManager;
import org.apache.maven.jxr.pacman.PackageManager;
import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.AbstractMavenReport;
@@ -73,10 +74,7 @@ public abstract class AbstractJxrReport extends AbstractMavenReport {
/**
* String used at the bottom of the Xref HTML files.
*/
- @Parameter(
- property = "bottom",
- defaultValue =
- "Copyright © {inceptionYear}–{currentYear} {organizationName}. All rights reserved.")
+ @Parameter(property = "bottom", defaultValue = "\u00A9 {inceptionYear}\u2013{currentYear} {organizationName}")
private String bottom;
// CHECKSTYLE_ON: LineLength
@@ -111,12 +109,6 @@ public abstract class AbstractJxrReport extends AbstractMavenReport {
@Parameter
private ArrayList includes;
- /**
- * The projects in the reactor for aggregation report.
- */
- @Parameter(defaultValue = "${reactorProjects}", readonly = true)
- protected List reactorProjects;
-
/**
* Whether to skip this execution.
*
@@ -202,23 +194,23 @@ && hasSources(currentFile)) {
}
/**
- * Creates the Xref for the Java files found in the given source directory and puts them in the given destination
+ * Creates the Xref for the Java files found in the given source directory and puts them in the given output
* directory.
*
* @param locale The user locale to use for the Xref generation
- * @param destinationDirectory The output directory
+ * @param outputDirectory The output directory
* @param sourceDirs The source directories
* @throws java.io.IOException
* @throws org.apache.maven.jxr.JxrException
*/
- private void createXref(Locale locale, String destinationDirectory, List sourceDirs)
+ private void createXref(Locale locale, File outputDirectory, List sourceDirs)
throws IOException, JxrException {
FileManager fileManager = new FileManager();
PackageManager packageManager = new PackageManager(fileManager);
JavaCodeTransform codeTransform = new JavaCodeTransform(packageManager, fileManager);
JXR jxr = new JXR(packageManager, codeTransform);
- jxr.setDest(Paths.get(destinationDirectory));
+ jxr.setDest(outputDirectory.toPath());
jxr.setInputEncoding(getInputEncoding());
jxr.setLocale(locale);
jxr.setOutputEncoding(getOutputEncoding());
@@ -242,11 +234,11 @@ private void createXref(Locale locale, String destinationDirectory, List
}
// and finally copy the stylesheet
- copyRequiredResources(destinationDirectory);
+ copyRequiredResources(outputDirectory);
}
/**
- * Returns the bottom text to be displayed at the lower part of the generated JXR reports.
+ * Returns the bottom text to be displayed at the lower part of the generated JXR report.
*/
private String getBottomText() {
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
@@ -258,12 +250,12 @@ private String getBottomText() {
if (inceptionYear != null) {
if (inceptionYear.equals(year)) {
- theBottom = StringUtils.replace(theBottom, "{inceptionYear}–", "");
+ theBottom = StringUtils.replace(theBottom, "{inceptionYear}\u2013", "");
} else {
theBottom = StringUtils.replace(theBottom, "{inceptionYear}", inceptionYear);
}
} else {
- theBottom = StringUtils.replace(theBottom, "{inceptionYear}–", "");
+ theBottom = StringUtils.replace(theBottom, "{inceptionYear}\u2013", "");
}
if (project.getOrganization() == null) {
@@ -293,28 +285,28 @@ private String getBottomText() {
}
/**
- * Copy some required resources (like the stylesheet) to the given directory
+ * Copy some required resources (like the stylesheet) to the given target directory
*
- * @param dir the directory to copy the resources to
+ * @param targetDirectory the directory to copy the resources to
*/
- private void copyRequiredResources(String dir) {
+ private void copyRequiredResources(File targetDirectory) {
if (stylesheet != null && !stylesheet.isEmpty()) {
File stylesheetFile = new File(stylesheet);
- File destStylesheetFile = new File(dir, "stylesheet.css");
+ File targetStylesheetFile = new File(targetDirectory, "stylesheet.css");
try {
if (stylesheetFile.isAbsolute()) {
- FileUtils.copyFile(stylesheetFile, destStylesheetFile);
+ FileUtils.copyFile(stylesheetFile, targetStylesheetFile);
} else {
URL stylesheetUrl = this.getClass().getClassLoader().getResource(stylesheet);
- FileUtils.copyURLToFile(stylesheetUrl, destStylesheetFile);
+ FileUtils.copyURLToFile(stylesheetUrl, targetStylesheetFile);
}
} catch (IOException e) {
getLog().warn("An error occured while copying the stylesheet to the target directory", e);
}
} else {
if (javadocTemplatesVersion.isAtLeast("1.8")) {
- copyResources(dir, "jdk8/", "stylesheet.css");
+ copyResources(targetDirectory, "jdk8/", "stylesheet.css");
} else if (javadocTemplatesVersion.isAtLeast("1.7")) {
String[] jdk7Resources = {
"stylesheet.css",
@@ -323,14 +315,14 @@ private void copyRequiredResources(String dir) {
"resources/titlebar.gif",
"resources/titlebar_end.gif"
};
- copyResources(dir, "jdk7/", jdk7Resources);
+ copyResources(targetDirectory, "jdk7/", jdk7Resources);
} else if (javadocTemplatesVersion.isAtLeast("1.6")) {
- copyResources(dir, "jdk6/", "stylesheet.css");
+ copyResources(targetDirectory, "jdk6/", "stylesheet.css");
} else if (javadocTemplatesVersion.isAtLeast("1.4")) {
- copyResources(dir, "jdk4/", "stylesheet.css");
+ copyResources(targetDirectory, "jdk4/", "stylesheet.css");
} else {
// Fallback to the original stylesheet
- copyResources(dir, "", "stylesheet.css");
+ copyResources(targetDirectory, "", "stylesheet.css");
}
}
}
@@ -338,16 +330,16 @@ private void copyRequiredResources(String dir) {
/**
* Copy styles and related resources to the given directory
*
- * @param dir the directory to copy the resources to
+ * @param targetDirectory the target directory to copy the resources to
* @param sourceDirectory resources subdirectory to copy from
* @param files names of files to copy
*/
- private void copyResources(String dir, String sourceDirectory, String... files) {
+ private void copyResources(File targetDirectory, String sourceDirectory, String... files) {
try {
for (String file : files) {
URL resourceUrl = this.getClass().getClassLoader().getResource(sourceDirectory + file);
- File destResourceFile = new File(dir, file);
- FileUtils.copyURLToFile(resourceUrl, destResourceFile);
+ File targetResourceFile = new File(targetDirectory, file);
+ FileUtils.copyURLToFile(resourceUrl, targetResourceFile);
}
} catch (IOException e) {
getLog().warn("An error occured while copying the resource to the target directory", e);
@@ -359,14 +351,18 @@ protected MavenProject getProject() {
return project;
}
- /**
- * Returns the Maven session.
- * @return Maven session
- */
protected MavenSession getSession() {
return session;
}
+ protected List getReactorProjects() {
+ return reactorProjects;
+ }
+
+ protected MojoExecution getMojoExecution() {
+ return mojoExecution;
+ }
+
/**
* Returns the correct resource bundle according to the locale.
*
@@ -386,7 +382,7 @@ protected void executeReport(Locale locale) throws MavenReportException {
setJavadocTemplatesVersion();
try {
- createXref(locale, getDestinationDirectory(), constructSourceDirs());
+ createXref(locale, getPluginReportOutputDirectory(), constructSourceDirs());
} catch (JxrException | IOException e) {
throw new MavenReportException("Error while generating the HTML source code of the project.", e);
}
@@ -450,7 +446,6 @@ protected List constructSourceDirs() {
@Override
public boolean canGenerateReport() {
if (skip) {
- getLog().info("Skipping JXR.");
return false;
}
@@ -528,11 +523,12 @@ private Path getJavadocLocation() throws IOException {
}
/**
- * Abstract method that returns the target directory where the generated JXR reports will be put.
+ * Abstract method that returns the plugin report output directory where the generated JXR report will be put
+ * beneath {@link #getReportOutputDirectory()}.
*
- * @return a String that contains the target directory name
+ * @return a File for the plugin's report output directory
*/
- protected abstract String getDestinationDirectory();
+ protected abstract File getPluginReportOutputDirectory();
/**
* Abstract method that returns the specified source directories that will be included in the JXR report generation.
diff --git a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrNoForkReport.java b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrNoForkReport.java
index a407ca83..b4d5ea58 100644
--- a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrNoForkReport.java
+++ b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrNoForkReport.java
@@ -23,7 +23,7 @@
import org.apache.maven.plugins.annotations.Mojo;
/**
- * Creates an html-based, cross referenced version of Java source code
+ * Creates an HTML-based, cross referenced version of Java source code
* for a project without forking. Note that this goal does require generation of sources before
* site generation, e.g. by invoking {@code }mvn clean deploy site}.
*
diff --git a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java
index 6a348f2b..dfe3e757 100644
--- a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java
+++ b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java
@@ -31,7 +31,7 @@
import org.apache.maven.project.MavenProject;
/**
- * Creates an html-based, cross referenced version of Java source code
+ * Creates an HTML-based, cross referenced version of Java source code
* for a project.
*
* @author Fabrice Bellingard
@@ -52,12 +52,6 @@ public class JxrReport extends AbstractJxrReport {
@Parameter
private String sourcePath;
- /**
- * Directory where the Xref files will be copied to.
- */
- @Parameter(defaultValue = "${project.reporting.outputDirectory}/xref")
- private String destDir;
-
/**
* Directory where Javadoc is generated for this project.
*/
@@ -65,8 +59,8 @@ public class JxrReport extends AbstractJxrReport {
private File javadocDir;
@Override
- protected String getDestinationDirectory() {
- return destDir;
+ protected File getPluginReportOutputDirectory() {
+ return new File(getReportOutputDirectory(), "xref");
}
@Override
@@ -80,12 +74,12 @@ protected List getSourceRoots() {
List l = new ArrayList<>();
- if (!"pom".equals(getProject().getPackaging().toLowerCase(Locale.US))) {
+ if (!"pom".equals(getProject().getPackaging().toLowerCase(Locale.ENGLISH))) {
l.addAll(sourceDirs);
}
if (getProject().getExecutionProject() != null) {
- if (!"pom".equals(getProject().getExecutionProject().getPackaging().toLowerCase(Locale.US))) {
+ if (!"pom".equals(getProject().getExecutionProject().getPackaging().toLowerCase(Locale.ENGLISH))) {
l.addAll(getProject().getExecutionProject().getCompileSourceRoots());
}
}
@@ -97,12 +91,12 @@ protected List getSourceRoots() {
protected List getSourceRoots(MavenProject project) {
List l = new ArrayList<>();
- if (!"pom".equals(project.getPackaging().toLowerCase(Locale.US))) {
+ if (!"pom".equals(project.getPackaging().toLowerCase(Locale.ENGLISH))) {
l.addAll(project.getCompileSourceRoots());
}
if (project.getExecutionProject() != null) {
- if (!"pom".equals(project.getExecutionProject().getPackaging().toLowerCase(Locale.US))) {
+ if (!"pom".equals(project.getExecutionProject().getPackaging().toLowerCase(Locale.ENGLISH))) {
l.addAll(project.getExecutionProject().getCompileSourceRoots());
}
}
@@ -129,14 +123,4 @@ public String getOutputName() {
protected File getJavadocDir() {
return javadocDir;
}
-
- @Override
- public void setReportOutputDirectory(File reportOutputDirectory) {
- if ((reportOutputDirectory != null)
- && (!reportOutputDirectory.getAbsolutePath().endsWith("xref"))) {
- this.destDir = new File(reportOutputDirectory, "xref").getAbsolutePath();
- } else {
- this.destDir = reportOutputDirectory.getAbsolutePath();
- }
- }
}
diff --git a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrTestNoForkReport.java b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrTestNoForkReport.java
index bf5d16c0..df32a827 100644
--- a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrTestNoForkReport.java
+++ b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrTestNoForkReport.java
@@ -23,7 +23,7 @@
import org.apache.maven.plugins.annotations.Mojo;
/**
- * Creates an html-based, cross referenced version of Java source code
+ * Creates an HTML-based, cross referenced version of Java source code
* for a project's test sources without forking. Note that this goal does require generation of test
* sources before site generation, e.g. by invoking {@code }mvn clean deploy site}.
*
diff --git a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrTestReport.java b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrTestReport.java
index 1f9d1584..7a390402 100644
--- a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrTestReport.java
+++ b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrTestReport.java
@@ -30,8 +30,8 @@
import org.apache.maven.project.MavenProject;
/**
- * Creates an html-based, cross referenced version of Java source code
- * for a project's test sources.
+ * Creates an HTML-based, cross referenced version of Java test source code
+ * for a project.
*
* @author Fabrice Bellingard
* @author Brett Porter
@@ -45,12 +45,6 @@ public class JxrTestReport extends AbstractJxrReport {
@Parameter(defaultValue = "${project.testCompileSourceRoots}", required = true, readonly = true)
private List sourceDirs;
- /**
- * Directory where the Xref files will be copied to.
- */
- @Parameter(defaultValue = "${project.reporting.outputDirectory}/xref-test")
- private String destDir;
-
/**
* Directory where Test Javadoc is generated for this project.
*/
@@ -61,12 +55,12 @@ public class JxrTestReport extends AbstractJxrReport {
protected List getSourceRoots() {
List l = new ArrayList<>();
- if (!"pom".equals(getProject().getPackaging().toLowerCase(Locale.US))) {
+ if (!"pom".equals(getProject().getPackaging().toLowerCase(Locale.ENGLISH))) {
l.addAll(sourceDirs);
}
if (getProject().getExecutionProject() != null) {
- if (!"pom".equals(getProject().getExecutionProject().getPackaging().toLowerCase(Locale.US))) {
+ if (!"pom".equals(getProject().getExecutionProject().getPackaging().toLowerCase(Locale.ENGLISH))) {
l.addAll(getProject().getExecutionProject().getTestCompileSourceRoots());
}
}
@@ -79,7 +73,7 @@ protected List getSourceRoots(MavenProject project) {
List l = new ArrayList<>();
if (project.getExecutionProject() != null) {
- if (!"pom".equals(project.getExecutionProject().getPackaging().toLowerCase(Locale.US))) {
+ if (!"pom".equals(project.getExecutionProject().getPackaging().toLowerCase(Locale.ENGLISH))) {
l.addAll(project.getExecutionProject().getTestCompileSourceRoots());
}
}
@@ -88,8 +82,8 @@ protected List getSourceRoots(MavenProject project) {
}
@Override
- protected String getDestinationDirectory() {
- return destDir;
+ protected File getPluginReportOutputDirectory() {
+ return new File(getReportOutputDirectory(), "xref-test");
}
@Override
@@ -111,14 +105,4 @@ public String getOutputName() {
protected File getJavadocDir() {
return testJavadocDir;
}
-
- @Override
- public void setReportOutputDirectory(File reportOutputDirectory) {
- if ((reportOutputDirectory != null)
- && (!reportOutputDirectory.getAbsolutePath().endsWith("xref-test"))) {
- this.destDir = new File(reportOutputDirectory, "xref-test").getAbsolutePath();
- } else {
- this.destDir = reportOutputDirectory.getAbsolutePath();
- }
- }
}
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/AbstractJxrTestCase.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/AbstractJxrTestCase.java
index b865c5a5..8a9ec5e3 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/AbstractJxrTestCase.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/AbstractJxrTestCase.java
@@ -21,8 +21,14 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
+import java.util.Collections;
+import java.util.List;
+import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.LegacySupport;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.plugin.testing.ArtifactStubFactory;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
@@ -112,8 +118,17 @@ protected AbstractJxrReport createReportMojo(String goal, File pluginXmlFile) th
repoSession.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory()
.newInstance(repoSession, new LocalRepository(artifactStubFactory.getWorkingDir())));
+ List reactorProjects =
+ mojo.getReactorProjects() != null ? mojo.getReactorProjects() : Collections.emptyList();
+
+ setVariableValueToObject(mojo, "mojoExecution", getMockMojoExecution());
setVariableValueToObject(mojo, "session", legacySupport.getSession());
- setVariableValueToObject(mojo, "remoteRepositories", mojo.getProject().getRemoteArtifactRepositories());
+ setVariableValueToObject(mojo, "repoSession", legacySupport.getRepositorySession());
+ setVariableValueToObject(mojo, "reactorProjects", reactorProjects);
+ setVariableValueToObject(
+ mojo, "remoteProjectRepositories", mojo.getProject().getRemoteProjectRepositories());
+ setVariableValueToObject(
+ mojo, "siteDirectory", new File(mojo.getProject().getBasedir(), "src/site"));
return mojo;
}
@@ -139,4 +154,22 @@ protected File generateReport(AbstractJxrReport mojo, File pluginXmlFile) throws
protected String readFile(File xrefTestDir, String fileName) throws IOException {
return new String(Files.readAllBytes(xrefTestDir.toPath().resolve(fileName)));
}
+
+ private MojoExecution getMockMojoExecution() {
+ MojoDescriptor md = new MojoDescriptor();
+ md.setGoal(getGoal());
+
+ MojoExecution me = new MojoExecution(md);
+
+ PluginDescriptor pd = new PluginDescriptor();
+ Plugin p = new Plugin();
+ p.setGroupId("org.apache.maven.plugins");
+ p.setArtifactId("maven-jxr-plugin");
+ pd.setPlugin(p);
+ md.setPluginDescriptor(pd);
+
+ return me;
+ }
+
+ protected abstract String getGoal();
}
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrReportTest.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrReportTest.java
index 2a614b65..268328d1 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrReportTest.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrReportTest.java
@@ -43,7 +43,7 @@ public void testDefaultConfiguration() throws Exception {
FileUtils.copyDirectory(new File(resourcesDir, "javadoc-files"), outputDir);
- generateReport("jxr", "default-configuration/default-configuration-plugin-config.xml");
+ generateReport(getGoal(), "default-configuration/default-configuration-plugin-config.xml");
// check if xref files were generated
assertTrue(new File(xrefDir, "allclasses-frame.html").exists());
@@ -80,7 +80,7 @@ public void testJdk4Configuration() throws Exception {
FileUtils.copyDirectory(new File(resourcesDir, "javadoc-files"), outputDir);
- generateReport("jxr", "default-configuration/default-configuration-plugin-config-4.xml");
+ generateReport(getGoal(), "default-configuration/default-configuration-plugin-config-4.xml");
// check if xref files were generated
assertTrue(new File(xrefDir, "allclasses-frame.html").exists());
@@ -95,10 +95,10 @@ public void testJdk4Configuration() throws Exception {
// check if there's a link to the javadoc files
String str = readFile(xrefDir, "def/configuration/AppSample.html");
- assertTrue(str.toLowerCase(Locale.US).contains("/apidocs/def/configuration/appsample.html\""));
+ assertTrue(str.toLowerCase(Locale.ENGLISH).contains("/apidocs/def/configuration/appsample.html\""));
str = readFile(xrefDir, "def/configuration/App.html");
- assertTrue(str.toLowerCase(Locale.US).contains("/apidocs/def/configuration/app.html\""));
+ assertTrue(str.toLowerCase(Locale.ENGLISH).contains("/apidocs/def/configuration/app.html\""));
// check if encoding is UTF-8, the default value
assertTrue(str.contains("text/html; charset=UTF-8"));
@@ -117,7 +117,7 @@ public void testJdk6Configuration() throws Exception {
FileUtils.copyDirectory(new File(resourcesDir, "javadoc-files"), outputDir);
- generateReport("jxr", "default-configuration/default-configuration-plugin-config-6.xml");
+ generateReport(getGoal(), "default-configuration/default-configuration-plugin-config-6.xml");
// check if xref files were generated
assertTrue(new File(xrefDir, "allclasses-frame.html").exists());
@@ -132,10 +132,10 @@ public void testJdk6Configuration() throws Exception {
// check if there's a link to the javadoc files
String str = readFile(xrefDir, "def/configuration/AppSample.html");
- assertTrue(str.toLowerCase(Locale.US).contains("/apidocs/def/configuration/appsample.html\""));
+ assertTrue(str.toLowerCase(Locale.ENGLISH).contains("/apidocs/def/configuration/appsample.html\""));
str = readFile(xrefDir, "def/configuration/App.html");
- assertTrue(str.toLowerCase(Locale.US).contains("/apidocs/def/configuration/app.html\""));
+ assertTrue(str.toLowerCase(Locale.ENGLISH).contains("/apidocs/def/configuration/app.html\""));
// check if encoding is UTF-8, the default value
assertTrue(str.contains("text/html; charset=UTF-8"));
@@ -154,7 +154,7 @@ public void testJdk7Configuration() throws Exception {
FileUtils.copyDirectory(new File(resourcesDir, "javadoc-files"), outputDir);
- generateReport("jxr", "default-configuration/default-configuration-plugin-config-7.xml");
+ generateReport(getGoal(), "default-configuration/default-configuration-plugin-config-7.xml");
// check if xref files were generated
assertTrue(new File(xrefDir, "allclasses-frame.html").exists());
@@ -173,10 +173,10 @@ public void testJdk7Configuration() throws Exception {
// check if there's a link to the javadoc files
String str = readFile(xrefDir, "def/configuration/AppSample.html");
- assertTrue(str.toLowerCase(Locale.US).contains("/apidocs/def/configuration/appsample.html\""));
+ assertTrue(str.toLowerCase(Locale.ENGLISH).contains("/apidocs/def/configuration/appsample.html\""));
str = readFile(xrefDir, "def/configuration/App.html");
- assertTrue(str.toLowerCase(Locale.US).contains("/apidocs/def/configuration/app.html\""));
+ assertTrue(str.toLowerCase(Locale.ENGLISH).contains("/apidocs/def/configuration/app.html\""));
// check if encoding is UTF-8, the default value
assertTrue(str.contains("text/html; charset=UTF-8"));
@@ -195,7 +195,7 @@ public void testJdk8Configuration() throws Exception {
FileUtils.copyDirectory(new File(resourcesDir, "javadoc-files"), outputDir);
- generateReport("jxr", "default-configuration/default-configuration-plugin-config-8.xml");
+ generateReport(getGoal(), "default-configuration/default-configuration-plugin-config-8.xml");
// check if xref files were generated
assertTrue(new File(xrefDir, "allclasses-frame.html").exists());
@@ -225,7 +225,7 @@ public void testJdk8Configuration() throws Exception {
* @throws Exception
*/
public void testNoJavadocLink() throws Exception {
- generateReport("jxr", "nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml");
+ generateReport(getGoal(), "nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml");
File xrefDir = new File(getBasedir(), "target/test/unit/nojavadoclink-configuration/target/site/xref");
@@ -245,10 +245,11 @@ public void testNoJavadocLink() throws Exception {
// check if there's a link to the javadoc files
String str = readFile(xrefDir, "nojavadoclink/configuration/AppSample.html");
- assertEquals(str.toLowerCase(Locale.US).indexOf("/apidocs/nojavadoclink/configuration/appsample.html\""), -1);
+ assertEquals(
+ str.toLowerCase(Locale.ENGLISH).indexOf("/apidocs/nojavadoclink/configuration/appsample.html\""), -1);
str = readFile(xrefDir, "nojavadoclink/configuration/App.html");
- assertEquals(str.toLowerCase(Locale.US).indexOf("/apidocs/nojavadoclink/configuration/app.html\""), -1);
+ assertEquals(str.toLowerCase(Locale.ENGLISH).indexOf("/apidocs/nojavadoclink/configuration/app.html\""), -1);
str = readFile(xrefDir, "nojavadoclink/configuration/sample/Sample.html");
assertEquals(str.toLowerCase().indexOf("/apidocs/nojavadoclink/configuration/sample/sample.html\""), -1);
@@ -263,7 +264,7 @@ public void testNoJavadocLink() throws Exception {
* @throws Exception
*/
public void testAggregate() throws Exception {
- generateReport("jxr", "aggregate-test/aggregate-test-plugin-config.xml");
+ generateReport(getGoal(), "aggregate-test/aggregate-test-plugin-config.xml");
File xrefDir = new File(getBasedir(), "target/test/unit/aggregate-test/target/site/xref");
@@ -286,16 +287,16 @@ public void testAggregate() throws Exception {
* @throws Exception
*/
public void testNoJavadocDir() throws Exception {
- generateReport("jxr", "nojavadocdir-test/nojavadocdir-test-plugin-config.xml");
+ generateReport(getGoal(), "nojavadocdir-test/nojavadocdir-test-plugin-config.xml");
File xrefDir = new File(getBasedir(), "target/test/unit/nojavadocdir-test/target/site/xref");
// check if there's a link to the javadoc files
String str = readFile(xrefDir, "nojavadocdir/test/AppSample.html");
- assertTrue(str.toLowerCase(Locale.US).contains("/apidocs/nojavadocdir/test/appsample.html"));
+ assertTrue(str.toLowerCase(Locale.ENGLISH).contains("/apidocs/nojavadocdir/test/appsample.html"));
str = readFile(xrefDir, "nojavadocdir/test/App.html");
- assertTrue(str.toLowerCase(Locale.US).contains("/apidocs/nojavadocdir/test/app.html"));
+ assertTrue(str.toLowerCase(Locale.ENGLISH).contains("/apidocs/nojavadocdir/test/app.html"));
}
/**
@@ -304,7 +305,7 @@ public void testNoJavadocDir() throws Exception {
* @throws Exception
*/
public void testExclude() throws Exception {
- generateReport("jxr", "exclude-configuration/exclude-configuration-plugin-config.xml");
+ generateReport(getGoal(), "exclude-configuration/exclude-configuration-plugin-config.xml");
Path xrefDir = new File(getBasedir(), "target/test/unit/exclude-configuration/target/site/xref").toPath();
@@ -321,7 +322,7 @@ public void testExclude() throws Exception {
* @throws Exception
*/
public void testInclude() throws Exception {
- generateReport("jxr", "include-configuration/include-configuration-plugin-config.xml");
+ generateReport(getGoal(), "include-configuration/include-configuration-plugin-config.xml");
Path xrefDir = new File(getBasedir(), "target/test/unit/include-configuration/target/site/xref").toPath();
@@ -334,7 +335,7 @@ public void testInclude() throws Exception {
public void testExceptions() {
try {
- generateReport("jxr", "default-configuration/exception-test-plugin-config.xml");
+ generateReport(getGoal(), "default-configuration/exception-test-plugin-config.xml");
fail("Must throw exception");
} catch (Exception e) {
@@ -348,8 +349,13 @@ public void testExceptions() {
* @throws Exception
*/
public void testPom() throws Exception {
- generateReport("jxr", "pom-test/pom-test-plugin-config.xml");
+ generateReport(getGoal(), "pom-test/pom-test-plugin-config.xml");
assertFalse(new File(getBasedir(), "target/test/unit/pom-test").exists());
}
+
+ @Override
+ protected String getGoal() {
+ return "jxr";
+ }
}
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrTestReportTest.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrTestReportTest.java
index 4acbc6ba..921c5823 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrTestReportTest.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrTestReportTest.java
@@ -30,7 +30,7 @@ public class JxrTestReportTest extends AbstractJxrTestCase {
* @throws Exception
*/
public void testSourceDir() throws Exception {
- generateReport("test-jxr", "testsourcedir-test/testsourcedir-test-plugin-config.xml");
+ generateReport(getGoal(), "testsourcedir-test/testsourcedir-test-plugin-config.xml");
File xrefTestDir = new File(getBasedir(), "target/test/unit/testsourcedir-test/target/site/xref-test");
@@ -52,4 +52,9 @@ public void testSourceDir() throws Exception {
str = readFile(xrefTestDir, "testsourcedir/test/AppTest.html");
assertFalse(str.toLowerCase().contains("/apidocs/testsourcedir/test/App.html\"".toLowerCase()));
}
+
+ @Override
+ protected String getGoal() {
+ return "test-jxr";
+ }
}
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/AggregateTestMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/AggregateTestMavenProjectStub.java
index 572e9c54..9c7e1fa5 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/AggregateTestMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/AggregateTestMavenProjectStub.java
@@ -18,7 +18,9 @@
*/
package org.apache.maven.plugin.jxr.stubs;
-import java.io.FileReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -26,24 +28,21 @@
import org.apache.maven.model.Model;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
/**
* @author Maria Odea Ching
*/
-public class AggregateTestMavenProjectStub extends MavenProjectStub {
+public class AggregateTestMavenProjectStub extends JxrProjectStub {
private List reportPlugins = new ArrayList<>();
public AggregateTestMavenProjectStub() {
MavenXpp3Reader pomReader = new MavenXpp3Reader();
Model model = null;
- try {
- model = pomReader.read(new FileReader(
- getBasedir() + "/src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml"));
+ try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+ model = pomReader.read(is);
setModel(model);
} catch (Exception ignored) {
-
}
setArtifactId(model.getArtifactId());
@@ -54,7 +53,7 @@ public AggregateTestMavenProjectStub() {
String basedir = getBasedir().getAbsolutePath();
List compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add(basedir + "/src/test/resources/unit/aggregate-test/aggregate/test");
+ compileSourceRoots.add(basedir + "/aggregate/test");
setCompileSourceRoots(compileSourceRoots);
// set the report plugins
@@ -70,4 +69,14 @@ public AggregateTestMavenProjectStub() {
public List getReportPlugins() {
return reportPlugins;
}
+
+ @Override
+ public File getBasedir() {
+ return new File(super.getBasedir() + "/aggregate-test");
+ }
+
+ @Override
+ protected String getPOM() {
+ return "aggregate-test-plugin-config.xml";
+ }
}
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/DefaultConfigurationMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/DefaultConfigurationMavenProjectStub.java
index d2219483..eab947e4 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/DefaultConfigurationMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/DefaultConfigurationMavenProjectStub.java
@@ -18,7 +18,9 @@
*/
package org.apache.maven.plugin.jxr.stubs;
-import java.io.FileReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -26,24 +28,21 @@
import org.apache.maven.model.Model;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
/**
* @author Maria Odea Ching
*/
-public class DefaultConfigurationMavenProjectStub extends MavenProjectStub {
+public class DefaultConfigurationMavenProjectStub extends JxrProjectStub {
private List reportPlugins = new ArrayList<>();
public DefaultConfigurationMavenProjectStub() {
MavenXpp3Reader pomReader = new MavenXpp3Reader();
Model model = null;
- try {
- model = pomReader.read(new FileReader(getBasedir()
- + "/src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml"));
+ try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+ model = pomReader.read(is);
setModel(model);
} catch (Exception ignored) {
-
}
setArtifactId(model.getArtifactId());
@@ -54,7 +53,7 @@ public DefaultConfigurationMavenProjectStub() {
String basedir = getBasedir().getAbsolutePath();
List compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add(basedir + "/src/test/resources/unit/default-configuration/def/configuration");
+ compileSourceRoots.add(basedir + "/def/configuration");
setCompileSourceRoots(compileSourceRoots);
// set the report plugins
@@ -69,4 +68,14 @@ public DefaultConfigurationMavenProjectStub() {
public List getReportPlugins() {
return reportPlugins;
}
+
+ @Override
+ public File getBasedir() {
+ return new File(super.getBasedir() + "/default-configuration");
+ }
+
+ @Override
+ protected String getPOM() {
+ return "default-configuration-plugin-config.xml";
+ }
}
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/ExcludeConfigurationMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/ExcludeConfigurationMavenProjectStub.java
index 9866204f..4ce55f77 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/ExcludeConfigurationMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/ExcludeConfigurationMavenProjectStub.java
@@ -18,7 +18,9 @@
*/
package org.apache.maven.plugin.jxr.stubs;
-import java.io.FileReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -37,12 +39,10 @@ public ExcludeConfigurationMavenProjectStub() {
MavenXpp3Reader pomReader = new MavenXpp3Reader();
Model model = null;
- try {
- model = pomReader.read(new FileReader(getBasedir()
- + "/src/test/resources/unit/exclude-configuration/exclude-configuration-plugin-config.xml"));
+ try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+ model = pomReader.read(is);
setModel(model);
} catch (Exception ignored) {
-
}
setArtifactId(model.getArtifactId());
@@ -53,7 +53,7 @@ public ExcludeConfigurationMavenProjectStub() {
String basedir = getBasedir().getAbsolutePath();
List compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add(basedir + "/src/test/resources/unit/exclude-configuration/exclude/configuration");
+ compileSourceRoots.add(basedir + "/exclude/configuration");
setCompileSourceRoots(compileSourceRoots);
// set the report plugins
@@ -68,4 +68,14 @@ public ExcludeConfigurationMavenProjectStub() {
public List getReportPlugins() {
return reportPlugins;
}
+
+ @Override
+ public File getBasedir() {
+ return new File(super.getBasedir() + "/exclude-configuration");
+ }
+
+ @Override
+ protected String getPOM() {
+ return "exclude-configuration-plugin-config.xml";
+ }
}
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/IncludeConfigurationMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/IncludeConfigurationMavenProjectStub.java
index 5130359b..617f6fa0 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/IncludeConfigurationMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/IncludeConfigurationMavenProjectStub.java
@@ -18,7 +18,9 @@
*/
package org.apache.maven.plugin.jxr.stubs;
-import java.io.FileReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -37,12 +39,10 @@ public IncludeConfigurationMavenProjectStub() {
MavenXpp3Reader pomReader = new MavenXpp3Reader();
Model model = null;
- try {
- model = pomReader.read(new FileReader(getBasedir()
- + "/src/test/resources/unit/include-configuration/include-configuration-plugin-config.xml"));
+ try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+ model = pomReader.read(is);
setModel(model);
} catch (Exception ignored) {
-
}
setArtifactId(model.getArtifactId());
@@ -53,7 +53,7 @@ public IncludeConfigurationMavenProjectStub() {
String basedir = getBasedir().getAbsolutePath();
List compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add(basedir + "/src/test/resources/unit/include-configuration/include/configuration");
+ compileSourceRoots.add(basedir + "/include/configuration");
setCompileSourceRoots(compileSourceRoots);
// set the report plugins
@@ -68,4 +68,14 @@ public IncludeConfigurationMavenProjectStub() {
public List getReportPlugins() {
return reportPlugins;
}
+
+ @Override
+ public File getBasedir() {
+ return new File(super.getBasedir() + "/include-configuration");
+ }
+
+ @Override
+ protected String getPOM() {
+ return "include-configuration-plugin-config.xml";
+ }
}
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/JxrProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/JxrProjectStub.java
index 12bf7d4c..57b40ca4 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/JxrProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/JxrProjectStub.java
@@ -18,16 +18,34 @@
*/
package org.apache.maven.plugin.jxr.stubs;
+import java.io.File;
import java.util.Collections;
import java.util.List;
+import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.MavenArtifactRepository;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.eclipse.aether.repository.RemoteRepository;
public abstract class JxrProjectStub extends MavenProjectStub {
+ /**
+ * @return the POM file name
+ */
+ protected abstract String getPOM();
+
+ @Override
+ public File getBasedir() {
+ return new File(super.getBasedir() + "/src/test/resources/unit/");
+ }
+
+ @Override
+ public File getFile() {
+ return new File(getBasedir(), getPOM());
+ }
+
@Override
public List getRemoteArtifactRepositories() {
ArtifactRepository repository = new MavenArtifactRepository(
@@ -39,4 +57,9 @@ public List getRemoteArtifactRepositories() {
return Collections.singletonList(repository);
}
+
+ @Override
+ public List getRemoteProjectRepositories() {
+ return RepositoryUtils.toRepos(getRemoteArtifactRepositories());
+ }
}
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocDirMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocDirMavenProjectStub.java
index 1e1368b4..8c75f11c 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocDirMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocDirMavenProjectStub.java
@@ -18,7 +18,9 @@
*/
package org.apache.maven.plugin.jxr.stubs;
-import java.io.FileReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -37,12 +39,10 @@ public NoJavadocDirMavenProjectStub() {
MavenXpp3Reader pomReader = new MavenXpp3Reader();
Model model = null;
- try {
- model = pomReader.read(new FileReader(
- getBasedir() + "/src/test/resources/unit/nojavadocdir-test/nojavadocdir-test-plugin-config.xml"));
+ try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+ model = pomReader.read(is);
setModel(model);
} catch (Exception ignored) {
-
}
setArtifactId(model.getArtifactId());
@@ -53,7 +53,7 @@ public NoJavadocDirMavenProjectStub() {
String basedir = getBasedir().getAbsolutePath();
List compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add(basedir + "/src/test/resources/unit/nojavadocdir-test/nojavadocdir/test");
+ compileSourceRoots.add(basedir + "/nojavadocdir/test");
setCompileSourceRoots(compileSourceRoots);
// set the report plugins
@@ -68,4 +68,14 @@ public NoJavadocDirMavenProjectStub() {
public List getReportPlugins() {
return reportPlugins;
}
+
+ @Override
+ public File getBasedir() {
+ return new File(super.getBasedir() + "/nojavadocdir-test");
+ }
+
+ @Override
+ protected String getPOM() {
+ return "nojavadocdir-test-plugin-config.xml";
+ }
}
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocLinkConfigurationMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocLinkConfigurationMavenProjectStub.java
index 342d8d64..8f89038b 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocLinkConfigurationMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocLinkConfigurationMavenProjectStub.java
@@ -18,7 +18,9 @@
*/
package org.apache.maven.plugin.jxr.stubs;
-import java.io.FileReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -26,26 +28,21 @@
import org.apache.maven.model.Model;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
/**
* @author Maria Odea Ching
*/
-public class NoJavadocLinkConfigurationMavenProjectStub extends MavenProjectStub {
+public class NoJavadocLinkConfigurationMavenProjectStub extends JxrProjectStub {
List reportPlugins;
public NoJavadocLinkConfigurationMavenProjectStub() {
MavenXpp3Reader pomReader = new MavenXpp3Reader();
Model model = null;
- try {
- model = pomReader.read(
- new FileReader(
- getBasedir()
- + "/src/test/resources/unit/nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml"));
+ try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+ model = pomReader.read(is);
setModel(model);
} catch (Exception ignored) {
-
}
setArtifactId(model.getArtifactId());
@@ -56,8 +53,7 @@ public NoJavadocLinkConfigurationMavenProjectStub() {
String basedir = getBasedir().getAbsolutePath();
List compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add(
- basedir + "/src/test/resources/unit/nojavadoclink-configuration/nojavadoclink/configuration");
+ compileSourceRoots.add(basedir + "/nojavadoclink/configuration");
setCompileSourceRoots(compileSourceRoots);
// set the report plugins
@@ -72,4 +68,14 @@ public NoJavadocLinkConfigurationMavenProjectStub() {
public List getReportPlugins() {
return reportPlugins;
}
+
+ @Override
+ public File getBasedir() {
+ return new File(super.getBasedir() + "/nojavadoclink-configuration");
+ }
+
+ @Override
+ protected String getPOM() {
+ return "nojavadoclink-configuration-plugin-config.xml";
+ }
}
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/PomMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/PomMavenProjectStub.java
index cadb456d..6682ba30 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/PomMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/PomMavenProjectStub.java
@@ -19,30 +19,29 @@
package org.apache.maven.plugin.jxr.stubs;
import java.io.File;
-import java.io.FileReader;
+import java.io.FileInputStream;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
/**
* @author Vincent Siveton
*/
-public class PomMavenProjectStub extends MavenProjectStub {
+public class PomMavenProjectStub extends JxrProjectStub {
private Build build;
public PomMavenProjectStub() {
MavenXpp3Reader pomReader = new MavenXpp3Reader();
- Model model;
+ Model model = null;
- try {
- model = pomReader.read(new FileReader(new File(getBasedir(), "pom-test-plugin-config.xml")));
+ try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+ model = pomReader.read(is);
setModel(model);
- } catch (Exception e) {
- throw new RuntimeException(e);
+ } catch (Exception ignored) {
}
setGroupId(model.getGroupId());
@@ -54,11 +53,11 @@ public PomMavenProjectStub() {
Build build = new Build();
build.setFinalName(model.getArtifactId());
- build.setDirectory(super.getBasedir() + "/target/test/unit/pom-test/target");
+ build.setDirectory(getBasedir() + "/target");
build.setSourceDirectory(getBasedir() + "/src/main/java");
- build.setOutputDirectory(super.getBasedir() + "/target/test/unit/pom-test/target/classes");
+ build.setOutputDirectory(getBasedir() + "/target/classes");
build.setTestSourceDirectory(getBasedir() + "/src/test/java");
- build.setTestOutputDirectory(super.getBasedir() + "/target/test/unit/pom-test/target/test-classes");
+ build.setTestOutputDirectory(getBasedir() + "/target/test-classes");
setBuild(build);
List compileSourceRoots = new ArrayList<>();
@@ -84,10 +83,13 @@ public void setBuild(Build build) {
this.build = build;
}
- /**
- * @see org.apache.maven.plugin.testing.stubs.MavenProjectStub#getBasedir()
- */
+ @Override
public File getBasedir() {
- return new File(super.getBasedir() + "/src/test/resources/unit/pom-test");
+ return new File(super.getBasedir() + "/pom-test");
+ }
+
+ @Override
+ protected String getPOM() {
+ return "pom-test-plugin-config.xml";
}
}
diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/TestSourceDirMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/TestSourceDirMavenProjectStub.java
index a286b607..3214cafc 100644
--- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/TestSourceDirMavenProjectStub.java
+++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/TestSourceDirMavenProjectStub.java
@@ -18,7 +18,9 @@
*/
package org.apache.maven.plugin.jxr.stubs;
-import java.io.FileReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -35,12 +37,10 @@ public TestSourceDirMavenProjectStub() {
MavenXpp3Reader pomReader = new MavenXpp3Reader();
Model model = null;
- try {
- model = pomReader.read(new FileReader(
- getBasedir() + "/src/test/resources/unit/testsourcedir-test/testsourcedir-test-plugin-config.xml"));
+ try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
+ model = pomReader.read(is);
setModel(model);
} catch (Exception ignored) {
-
}
setArtifactId(model.getArtifactId());
@@ -51,11 +51,21 @@ public TestSourceDirMavenProjectStub() {
String basedir = getBasedir().getAbsolutePath();
List compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add(basedir + "/src/test/resources/unit/testsourcedir-test");
+ compileSourceRoots.add(basedir);
setCompileSourceRoots(compileSourceRoots);
Artifact artifact = new JxrPluginArtifactStub(getGroupId(), getArtifactId(), getVersion(), getPackaging());
artifact.setArtifactHandler(new DefaultArtifactHandlerStub());
setArtifact(artifact);
}
+
+ @Override
+ public File getBasedir() {
+ return new File(super.getBasedir() + "/testsourcedir-test");
+ }
+
+ @Override
+ protected String getPOM() {
+ return "testsourcedir-test-plugin-config.xml";
+ }
}
diff --git a/maven-jxr-plugin/src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml
index 27bac585..73c0ab46 100644
--- a/maven-jxr-plugin/src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml
+++ b/maven-jxr-plugin/src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml
@@ -41,7 +41,6 @@ under the License.
${basedir}/src/test/resources/unit/aggregate-test/submodule1
${basedir}/src/test/resources/unit/aggregate-test/submodule2
- ${basedir}/target/test/unit/aggregate-test/target/site/xref
${basedir}/target/test/unit/aggregate-test/target/site/apidocs
false
Copyright 2006 Apache Foundation
@@ -51,7 +50,6 @@ under the License.
- ${localRepository}
diff --git a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-4.xml b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-4.xml
index bf302a1b..410f864f 100644
--- a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-4.xml
+++ b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-4.xml
@@ -39,12 +39,10 @@ under the License.
${basedir}/src/test/resources/unit/default-configuration
- ${basedir}/target/test/unit/default-configuration/target/site/4/xref
${basedir}/target/test/unit/default-configuration/target/site/4/apidocs
true
Copyright 2006 Apache Foundation
1.4
- ${localRepository}
diff --git a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-6.xml b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-6.xml
index eac7aeea..5d0184db 100644
--- a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-6.xml
+++ b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-6.xml
@@ -39,12 +39,10 @@ under the License.
${basedir}/src/test/resources/unit/default-configuration
- ${basedir}/target/test/unit/default-configuration/target/site/6/xref
${basedir}/target/test/unit/default-configuration/target/site/6/apidocs
true
Copyright 2006 Apache Foundation
1.6
- ${localRepository}
diff --git a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-7.xml b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-7.xml
index dbe4d6d0..8620129b 100644
--- a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-7.xml
+++ b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-7.xml
@@ -39,12 +39,10 @@ under the License.
${basedir}/src/test/resources/unit/default-configuration
- ${basedir}/target/test/unit/default-configuration/target/site/7/xref
${basedir}/target/test/unit/default-configuration/target/site/7/apidocs
true
Copyright 2006 Apache Foundation
1.7
- ${localRepository}
diff --git a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-8.xml b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-8.xml
index 9e330921..486776a7 100644
--- a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-8.xml
+++ b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-8.xml
@@ -39,12 +39,10 @@ under the License.
${basedir}/src/test/resources/unit/default-configuration
- ${basedir}/target/test/unit/default-configuration/target/site/8/xref
${basedir}/target/test/unit/default-configuration/target/site/8/apidocs
true
Copyright 2006 Apache Foundation
1.8
- ${localRepository}
diff --git a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml
index 1f4769d4..a457dce8 100644
--- a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml
+++ b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml
@@ -39,14 +39,12 @@ under the License.
${basedir}/src/test/resources/unit/default-configuration
- ${basedir}/target/test/unit/default-configuration/target/site/xref
${basedir}/target/test/unit/default-configuration/target/site/apidocs
true
Copyright 2006 Apache Foundation
templates
stylesheet.css
3
- ${localRepository}
diff --git a/maven-jxr-plugin/src/test/resources/unit/default-configuration/exception-test-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/default-configuration/exception-test-plugin-config.xml
index cd37da41..06039de9 100644
--- a/maven-jxr-plugin/src/test/resources/unit/default-configuration/exception-test-plugin-config.xml
+++ b/maven-jxr-plugin/src/test/resources/unit/default-configuration/exception-test-plugin-config.xml
@@ -40,13 +40,11 @@ under the License.
${basedir}/src/test/resources/unit/default-configuration
- ${basedir}/target/test/unit/default-configuration/target/site/xref
${basedir}/target/test/unit/default-configuration/target/site/apidocs
true
Copyright 2006 Apache Foundation
temp
stylesheet.css
- ${localRepository}
diff --git a/maven-jxr-plugin/src/test/resources/unit/exclude-configuration/exclude-configuration-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/exclude-configuration/exclude-configuration-plugin-config.xml
index d1364876..ff9bef70 100644
--- a/maven-jxr-plugin/src/test/resources/unit/exclude-configuration/exclude-configuration-plugin-config.xml
+++ b/maven-jxr-plugin/src/test/resources/unit/exclude-configuration/exclude-configuration-plugin-config.xml
@@ -40,7 +40,6 @@ under the License.
${basedir}/src/test/resources/unit/exclude-configuration
- ${basedir}/target/test/unit/exclude-configuration/target/site/xref
${basedir}/target/test/unit/exclude-configuration/target/site/apidocs
true
Copyright 2006 Apache Foundation
@@ -49,7 +48,6 @@ under the License.
**/AppSample.java
- ${localRepository}
diff --git a/maven-jxr-plugin/src/test/resources/unit/include-configuration/include-configuration-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/include-configuration/include-configuration-plugin-config.xml
index d0cfaed3..2cda9596 100644
--- a/maven-jxr-plugin/src/test/resources/unit/include-configuration/include-configuration-plugin-config.xml
+++ b/maven-jxr-plugin/src/test/resources/unit/include-configuration/include-configuration-plugin-config.xml
@@ -40,7 +40,6 @@ under the License.
${basedir}/src/test/resources/unit/include-configuration
- ${basedir}/target/test/unit/include-configuration/target/site/xref
${basedir}/target/test/unit/include-configuration/target/site/apidocs
true
Copyright 2006 Apache Foundation
@@ -49,7 +48,6 @@ under the License.
**/App.java
- ${localRepository}
diff --git a/maven-jxr-plugin/src/test/resources/unit/nojavadocdir-test/nojavadocdir-test-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/nojavadocdir-test/nojavadocdir-test-plugin-config.xml
index 0c3a0b26..fed568a8 100644
--- a/maven-jxr-plugin/src/test/resources/unit/nojavadocdir-test/nojavadocdir-test-plugin-config.xml
+++ b/maven-jxr-plugin/src/test/resources/unit/nojavadocdir-test/nojavadocdir-test-plugin-config.xml
@@ -40,13 +40,11 @@ under the License.
${basedir}/src/test/resources/unit/nojavadocdir-test
- ${basedir}/target/test/unit/nojavadocdir-test/target/site/xref
${basedir}/target/test/unit/nojavadocdir-test/target/site/apidocs
true
Copyright 2006 Apache Foundation
1.4
stylesheet.css
- ${localRepository}
diff --git a/maven-jxr-plugin/src/test/resources/unit/nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml
index ba569bce..b66627d2 100644
--- a/maven-jxr-plugin/src/test/resources/unit/nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml
+++ b/maven-jxr-plugin/src/test/resources/unit/nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml
@@ -40,13 +40,11 @@ under the License.
${basedir}/src/test/resources/unit/nojavadoclink-configuration
- ${basedir}/target/test/unit/nojavadoclink-configuration/target/site/xref
${basedir}/target/test/unit/nojavadoclink-configuration/target/site/apidocs
false
Copyright 2006 Apache Foundation
1.4
stylesheet.css
- ${localRepository}
diff --git a/maven-jxr-plugin/src/test/resources/unit/pom-test/pom-test-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/pom-test/pom-test-plugin-config.xml
index 257aa0ba..ae65ab4d 100644
--- a/maven-jxr-plugin/src/test/resources/unit/pom-test/pom-test-plugin-config.xml
+++ b/maven-jxr-plugin/src/test/resources/unit/pom-test/pom-test-plugin-config.xml
@@ -41,7 +41,6 @@ under the License.
${basedir}/target/test/unit/pom-test/target/site/
- ${localRepository}
diff --git a/maven-jxr-plugin/src/test/resources/unit/testsourcedir-test/testsourcedir-test-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/testsourcedir-test/testsourcedir-test-plugin-config.xml
index 23bccd90..75834997 100644
--- a/maven-jxr-plugin/src/test/resources/unit/testsourcedir-test/testsourcedir-test-plugin-config.xml
+++ b/maven-jxr-plugin/src/test/resources/unit/testsourcedir-test/testsourcedir-test-plugin-config.xml
@@ -40,11 +40,9 @@ under the License.
${basedir}/src/test/resources/unit/testsourcedir-test/src/test/java
- ${basedir}/target/test/unit/testsourcedir-test/target/site/xref-test
Copyright 2006 Apache Foundation
1.4
stylesheet.css
- ${localRepository}
diff --git a/maven-jxr/pom.xml b/maven-jxr/pom.xml
index 0c2098e4..3dfd0605 100644
--- a/maven-jxr/pom.xml
+++ b/maven-jxr/pom.xml
@@ -42,8 +42,8 @@ under the License.
org.apache.velocity
- velocity
- 1.7
+ velocity-engine-core
+ 2.3
@@ -64,7 +64,7 @@ under the License.
org.apache.maven.plugins
maven-checkstyle-plugin
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- ${javadocPluginVersion}
-
-
- org.apache.maven.plugins
- maven-site-plugin
- ${sitePluginVersion}
-
-
-
-
-
reporting