Skip to content

Commit

Permalink
Fix for mojohaus#213: Use relative links to make the per-module and t…
Browse files Browse the repository at this point in the history
…he aggregate report work.
  • Loading branch information
Aaron Digulla committed Jan 25, 2019
1 parent 94d94be commit 4e6a692
Show file tree
Hide file tree
Showing 7 changed files with 224 additions and 2 deletions.
49 changes: 49 additions & 0 deletions src/it/aggregate-third-party-report/child1/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
License Maven Plugin
%%
Copyright (C) 2008 - 2011 CodeLutin, Codehaus, Tony Chemit
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Lesser Public License for more details.
You should have received a copy of the GNU General Lesser Public
License along with this program. If not, see
<http://www.gnu.org/licenses/lgpl-3.0.html>.
#L%
-->

<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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.codehaus.mojo.license.test</groupId>
<artifactId>test-aggregate-third-party-report</artifactId>
<version>@pom.version@</version>
</parent>
<artifactId>test-aggregate-third-party-report-child1</artifactId>

<name>License Test :: aggregate-third-party-report - child 1</name>

<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>

</project>


50 changes: 50 additions & 0 deletions src/it/aggregate-third-party-report/child2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
License Maven Plugin
%%
Copyright (C) 2008 - 2011 CodeLutin, Codehaus, Tony Chemit
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Lesser Public License for more details.
You should have received a copy of the GNU General Lesser Public
License along with this program. If not, see
<http://www.gnu.org/licenses/lgpl-3.0.html>.
#L%
-->

<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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.codehaus.mojo.license.test</groupId>
<artifactId>test-aggregate-third-party-report</artifactId>
<version>@pom.version@</version>
</parent>
<artifactId>test-aggregate-third-party-report-child2</artifactId>

<name>License Test :: aggregate-third-party-report - child 2</name>

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

</project>


23 changes: 23 additions & 0 deletions src/it/aggregate-third-party-report/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
###
# #%L
# License Maven Plugin
# %%
# Copyright (C) 2008 - 2011 CodeLutin, Codehaus, Tony Chemit
# %%
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Lesser Public License for more details.
#
# You should have received a copy of the GNU General Lesser Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/lgpl-3.0.html>.
# #L%
###
invoker.goals=clean license:aggregate-third-party-report
invoker.failureBehavior=fail-fast
65 changes: 65 additions & 0 deletions src/it/aggregate-third-party-report/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
License Maven Plugin
%%
Copyright (C) 2008 - 2011 CodeLutin, Codehaus, Tony Chemit
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Lesser Public License for more details.
You should have received a copy of the GNU General Lesser Public
License along with this program. If not, see
<http://www.gnu.org/licenses/lgpl-3.0.html>.
#L%
-->

<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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>org.codehaus.mojo.license.test</groupId>
<artifactId>test-aggregate-third-party-report</artifactId>
<version>@pom.version@</version>

<modules>
<module>child1</module>
<module>child2</module>
</modules>

<name>License Test :: aggregate-third-party-report</name>

<packaging>pom</packaging>

<properties>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<license.generateBundle>true</license.generateBundle>
<license.verbose>true</license.verbose>
</properties>

<build>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>@pom.version@</version>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>


35 changes: 35 additions & 0 deletions src/it/aggregate-third-party-report/postbuild.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* #%L
* License Maven Plugin
* %%
* Copyright (C) 2008 - 2011 CodeLutin, Codehaus, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
* #L%
*/

file = new File(basedir, 'target/site/aggregate-third-party-report.html');
assert file.exists();
content = file.text;
assert !content.contains('the project has no dependencies.');
assert !content.contains('/third-party-report.html#');
assert content.contains('<a href="#commons-logging:commons-logging:1.1.1">commons-logging:commons-logging:1.1.1</a>');
assert content.contains('<td>The Apache Software License, Version 2.0</td>'); // TODO Should be a link
assert content.contains('<a href="#Overview">Back to top</a>');

file = new File(basedir, 'target/site/third-party-report.html');
assert !file.exists();

return true;
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ else if ( details.hasThirdPartyLicenses() )

sink.tableCell();
String gav = getGAV( details );
sink.link( "./third-party-report.html#" + gav );
sink.link( "#" + gav );
sink.text( gav );
sink.link_();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ private void renderThirdPartyDetail( ThirdPartyDetails detail )
sink.sectionTitle2_();
renderThirdPartyDetailTable( detail );

sink.link( "./third-party-report.html#" + getText( "report.overview.title" ) );
sink.link( "#" + getText( "report.overview.title" ) );
sink.text( getText( "report.back.to.top.page" ) );
sink.link_();
sink.lineBreak();
Expand Down

0 comments on commit 4e6a692

Please sign in to comment.