Skip to content

Commit 22b8ed6

Browse files
[MPH-194] Upgrade Parent to 39 - code reformat
1 parent 8fa6486 commit 22b8ed6

15 files changed

+1389
-1910
lines changed

pom.xml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<?xml version='1.0' encoding='UTF-8'?>
2-
1+
<?xml version="1.0" encoding="UTF-8"?>
32
<!--
43
Licensed to the Apache Software Foundation (ASF) under one
54
or more contributor license agreements. See the NOTICE file
@@ -18,7 +17,6 @@
1817
specific language governing permissions and limitations
1918
under the License.
2019
-->
21-
2220
<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">
2321
<modelVersion>4.0.0</modelVersion>
2422

@@ -34,12 +32,10 @@
3432
<packaging>maven-plugin</packaging>
3533

3634
<name>Apache Maven Help Plugin</name>
37-
<description>
38-
The Maven Help plugin provides goals aimed at helping to make sense out of
35+
<description>The Maven Help plugin provides goals aimed at helping to make sense out of
3936
the build environment. It includes the ability to view the effective
4037
POM and settings files, after inheritance and active profiles
41-
have been applied, as well as a describe a particular plugin goal to give usage information.
42-
</description>
38+
have been applied, as well as a describe a particular plugin goal to give usage information.</description>
4339
<inceptionYear>2001</inceptionYear>
4440

4541
<prerequisites>
@@ -49,8 +45,8 @@
4945
<scm>
5046
<connection>scm:git:https://gitbox.apache.org/repos/asf/maven-help-plugin.git</connection>
5147
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-help-plugin.git</developerConnection>
52-
<url>https://github.com/apache/maven-help-plugin/tree/${project.scm.tag}</url>
5348
<tag>HEAD</tag>
49+
<url>https://github.com/apache/maven-help-plugin/tree/${project.scm.tag}</url>
5450
</scm>
5551
<issueManagement>
5652
<system>JIRA</system>
@@ -186,7 +182,8 @@
186182
<dependency>
187183
<groupId>org.apache.commons</groupId>
188184
<artifactId>commons-lang3</artifactId>
189-
<version>3.8.1</version> <!-- commons-lang3 > 3.8.1 requires at least Java 8 -->
185+
<!-- commons-lang3 > 3.8.1 requires at least Java 8 -->
186+
<version>3.8.1</version>
190187
</dependency>
191188

192189
<!-- test -->
@@ -240,10 +237,10 @@
240237
<artifactId>maven-dependency-plugin</artifactId>
241238
<executions>
242239
<execution>
243-
<phase>generate-sources</phase>
244240
<goals>
245241
<goal>unpack</goal>
246242
</goals>
243+
<phase>generate-sources</phase>
247244
<configuration>
248245
<artifactItems>
249246
<artifactItem>
@@ -267,7 +264,8 @@
267264
<models>
268265
<model>target/apache-maven-${mavenVersion}/maven-model/src/main/mdo/maven.mdo</model>
269266
</models>
270-
<extendedClassnameSuffix>ExOldSupport</extendedClassnameSuffix><!-- to avoid conflict with class provided by Maven core -->
267+
<!-- to avoid conflict with class provided by Maven core -->
268+
<extendedClassnameSuffix>ExOldSupport</extendedClassnameSuffix>
271269
</configuration>
272270
<executions>
273271
<execution>
Lines changed: 39 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
package org.apache.maven.plugins.help;
2-
31
/*
42
* Licensed to the Apache Software Foundation (ASF) under one
53
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,9 @@
1816
* specific language governing permissions and limitations
1917
* under the License.
2018
*/
19+
package org.apache.maven.plugins.help;
20+
21+
import javax.xml.XMLConstants;
2122

2223
import java.io.File;
2324
import java.io.IOException;
@@ -40,17 +41,13 @@
4041
import org.jdom2.output.Format;
4142
import org.jdom2.output.XMLOutputter;
4243

43-
import javax.xml.XMLConstants;
44-
4544
/**
4645
* Base class with common utilities to write effective Pom/settings.
4746
*
4847
* @author <a href="mailto:[email protected]">Vincent Siveton</a>
4948
* @since 2.1
5049
*/
51-
public abstract class AbstractEffectiveMojo
52-
extends AbstractHelpMojo
53-
{
50+
public abstract class AbstractEffectiveMojo extends AbstractHelpMojo {
5451
/**
5552
* Utility method to write an XML content in a given file.
5653
*
@@ -59,18 +56,14 @@ public abstract class AbstractEffectiveMojo
5956
* @throws IOException if any
6057
* @see AbstractHelpMojo#writeFile(File, String) if encoding is null.
6158
*/
62-
protected static void writeXmlFile( File output, String content )
63-
throws IOException
64-
{
65-
if ( output == null )
66-
{
59+
protected static void writeXmlFile(File output, String content) throws IOException {
60+
if (output == null) {
6761
return;
6862
}
6963

7064
output.getParentFile().mkdirs();
71-
try ( Writer out = WriterFactory.newXmlWriter( output ) )
72-
{
73-
out.write( content );
65+
try (Writer out = WriterFactory.newXmlWriter(output)) {
66+
out.write(content);
7467
}
7568
}
7669

@@ -79,14 +72,13 @@ protected static void writeXmlFile( File output, String content )
7972
*
8073
* @param writer not null
8174
*/
82-
protected static void writeHeader( XMLWriter writer )
83-
{
84-
XmlWriterUtil.writeCommentLineBreak( writer );
85-
XmlWriterUtil.writeComment( writer, " " );
86-
XmlWriterUtil.writeComment( writer, "Generated by Maven Help Plugin" );
87-
XmlWriterUtil.writeComment( writer, "See: https://maven.apache.org/plugins/maven-help-plugin/" );
88-
XmlWriterUtil.writeComment( writer, " " );
89-
XmlWriterUtil.writeCommentLineBreak( writer );
75+
protected static void writeHeader(XMLWriter writer) {
76+
XmlWriterUtil.writeCommentLineBreak(writer);
77+
XmlWriterUtil.writeComment(writer, " ");
78+
XmlWriterUtil.writeComment(writer, "Generated by Maven Help Plugin");
79+
XmlWriterUtil.writeComment(writer, "See: https://maven.apache.org/plugins/maven-help-plugin/");
80+
XmlWriterUtil.writeComment(writer, " ");
81+
XmlWriterUtil.writeCommentLineBreak(writer);
9082
}
9183

9284
/**
@@ -95,13 +87,12 @@ protected static void writeHeader( XMLWriter writer )
9587
* @param writer not null
9688
* @param comment not null
9789
*/
98-
protected static void writeComment( XMLWriter writer, String comment )
99-
{
100-
XmlWriterUtil.writeCommentLineBreak( writer );
101-
XmlWriterUtil.writeComment( writer, " " );
102-
XmlWriterUtil.writeComment( writer, comment );
103-
XmlWriterUtil.writeComment( writer, " " );
104-
XmlWriterUtil.writeCommentLineBreak( writer );
90+
protected static void writeComment(XMLWriter writer, String comment) {
91+
XmlWriterUtil.writeCommentLineBreak(writer);
92+
XmlWriterUtil.writeComment(writer, " ");
93+
XmlWriterUtil.writeComment(writer, comment);
94+
XmlWriterUtil.writeComment(writer, " ");
95+
XmlWriterUtil.writeCommentLineBreak(writer);
10596
}
10697

10798
/**
@@ -110,54 +101,46 @@ protected static void writeComment( XMLWriter writer, String comment )
110101
* @param omitDeclaration whether the XML declaration should be omitted from the effective pom
111102
* @return pretty format of the xml or the original {@code effectiveModel} if an error occurred.
112103
*/
113-
protected static String prettyFormat( String effectiveModel, String encoding, boolean omitDeclaration )
114-
{
104+
protected static String prettyFormat(String effectiveModel, String encoding, boolean omitDeclaration) {
115105
SAXBuilder builder = new SAXBuilder();
116-
builder.setProperty( XMLConstants.ACCESS_EXTERNAL_DTD, "" );
117-
builder.setProperty( XMLConstants.ACCESS_EXTERNAL_SCHEMA, "" );
118-
try
119-
{
120-
Document effectiveDocument = builder.build( new StringReader( effectiveModel ) );
106+
builder.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
107+
builder.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
108+
try {
109+
Document effectiveDocument = builder.build(new StringReader(effectiveModel));
121110

122111
StringWriter w = new StringWriter();
123112
Format format = Format.getPrettyFormat();
124-
if ( encoding != null )
125-
{
113+
if (encoding != null) {
126114
// This is a design flaw in JDOM, no NPE on null arguments, but null is not prohibited
127-
format.setEncoding( encoding );
115+
format.setEncoding(encoding);
128116
}
129-
format.setLineSeparator( System.lineSeparator() );
130-
format.setOmitDeclaration( omitDeclaration );
131-
XMLOutputter out = new XMLOutputter( format );
132-
out.output( effectiveDocument, w );
117+
format.setLineSeparator(System.lineSeparator());
118+
format.setOmitDeclaration(omitDeclaration);
119+
XMLOutputter out = new XMLOutputter(format);
120+
out.output(effectiveDocument, w);
133121

134122
return w.toString();
135-
}
136-
catch ( JDOMException | IOException e )
137-
{
123+
} catch (JDOMException | IOException e) {
138124
return effectiveModel;
139125
}
140126
}
141127

142128
/**
143129
* Properties which provides a sorted keySet().
144130
*/
145-
protected static class SortedProperties
146-
extends Properties
147-
{
131+
protected static class SortedProperties extends Properties {
148132
/** serialVersionUID */
149133
static final long serialVersionUID = -8985316072702233744L;
150134

151135
/** {@inheritDoc} */
152-
@SuppressWarnings( { "rawtypes", "unchecked" } )
136+
@SuppressWarnings({"rawtypes", "unchecked"})
153137
@Override
154-
public Set<Object> keySet()
155-
{
138+
public Set<Object> keySet() {
156139
Set<Object> keynames = super.keySet();
157-
List list = new ArrayList( keynames );
158-
Collections.sort( list );
140+
List list = new ArrayList(keynames);
141+
Collections.sort(list);
159142

160-
return new LinkedHashSet<>( list );
143+
return new LinkedHashSet<>(list);
161144
}
162145
}
163146
}

0 commit comments

Comments
 (0)