Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MPIR-412] Fix dependency report tag balance when exception #31

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/it/MPIR-412/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 = ${project.groupId}:${project.artifactId}:${project.version}:dependencies
55 changes: 55 additions & 0 deletions src/it/MPIR-412/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.project-info-reports.its</groupId>
<artifactId>MPIR-412</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<url>http://maven.apache.org/plugins/it/${project.artifactId}</url>

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

<dependencies>
<!-- an example of a dependency with a problematic POM -->
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis-ext</artifactId>
<version>1.3.04</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>@pom.version@</version>
</plugin>
</plugins>
</build>

</project>
24 changes: 24 additions & 0 deletions src/it/MPIR-412/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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.
*/

// should be able to parse the output as XML
parser = new XmlParser();
parser.setFeature('http://apache.org/xml/features/disallow-doctype-decl', false);
result = parser.parse(new File(basedir, 'target/site/dependencies.html'));
assert result instanceof Node;
Original file line number Diff line number Diff line change
Expand Up @@ -889,8 +889,6 @@ private void printDescriptionsAndURLs( DependencyNode node, String uid )

sink.rawText( "<div id=\"" + uid + "\" style=\"display:none\">" );

sink.table();

if ( !Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
{
try
Expand All @@ -902,6 +900,8 @@ private void printDescriptionsAndURLs( DependencyNode node, String uid )

List<License> licenses = artifactProject.getLicenses();

sink.table();

sink.tableRow();
sink.tableHeaderCell();
sink.text( artifactName );
Expand Down Expand Up @@ -989,6 +989,11 @@ private void printDescriptionsAndURLs( DependencyNode node, String uid )
licenseMap.put( unknownLicenseMessage, artifactName );
}
sink.paragraph_();

sink.tableCell_();
sink.tableRow_();

sink.table_();
}
catch ( ProjectBuildingException e )
{
Expand All @@ -1006,6 +1011,8 @@ private void printDescriptionsAndURLs( DependencyNode node, String uid )
}
else
{
sink.table();

sink.tableRow();
sink.tableHeaderCell();
sink.text( id );
Expand All @@ -1031,12 +1038,12 @@ private void printDescriptionsAndURLs( DependencyNode node, String uid )
sink.text( artifact.getFile().getAbsolutePath() );
sink.paragraph_();
}
}

sink.tableCell_();
sink.tableRow_();
sink.tableCell_();
sink.tableRow_();

sink.table_();
sink.table_();
}

sink.rawText( "</div>" );
}
Expand Down