Skip to content

Commit

Permalink
Enable spotless plugin - automatic code formatting - reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
slawekjaranowski committed Mar 18, 2023
1 parent e9fcdaf commit 22993ef
Show file tree
Hide file tree
Showing 23 changed files with 2,989 additions and 3,652 deletions.
44 changes: 21 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@

<name>Maven Flatten Plugin</name>

<description>
Plugin to generate flattened POM (reduced and resolved information required for consumers of maven repositories)
and to use (install, sign, deploy) it instead of original pom.xml.
</description>
<description>Plugin to generate flattened POM (reduced and resolved information required for consumers of maven repositories)
and to use (install, sign, deploy) it instead of original pom.xml.</description>

<url>https://www.mojohaus.org/flatten-maven-plugin/</url>

Expand Down Expand Up @@ -64,10 +62,10 @@
<id>rfscholte</id>
<name>Robert Scholte</name>
<email>[email protected]</email>
<timezone>Europe/Amsterdam</timezone>
<roles>
<role>developer</role>
</roles>
<timezone>Europe/Amsterdam</timezone>
</developer>
<developer>
<id>khmarbaise</id>
Expand All @@ -80,10 +78,10 @@
<id>sjaranowski</id>
<name>Slawomir Jaranowski</name>
<email>[email protected]</email>
<timezone>Europe/Warsaw</timezone>
<roles>
<role>developer</role>
</roles>
<timezone>Europe/Warsaw</timezone>
</developer>
</developers>

Expand Down Expand Up @@ -124,8 +122,8 @@
<scm>
<connection>scm:git:https://github.com/mojohaus/flatten-maven-plugin.git</connection>
<developerConnection>scm:git:ssh://[email protected]/mojohaus/flatten-maven-plugin.git</developerConnection>
<url>https://github.com/mojohaus/flatten-maven-plugin/tree/master</url>
<tag>HEAD</tag>
<url>https://github.com/mojohaus/flatten-maven-plugin/tree/master</url>
</scm>

<properties>
Expand Down Expand Up @@ -283,15 +281,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>install</goal>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<debug>true</debug>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
Expand All @@ -310,19 +299,20 @@
<postBuildHookScript>verify</postBuildHookScript>
<preBuildHookScript>setup</preBuildHookScript>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>mrm-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>start</goal>
<goal>stop</goal>
<goal>install</goal>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>mrm-maven-plugin</artifactId>
<configuration>
<propertyName>repository.proxy.url</propertyName>
<repositories>
Expand All @@ -335,6 +325,14 @@
<proxyRepo />
</repositories>
</configuration>
<executions>
<execution>
<goals>
<goal>start</goal>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
155 changes: 74 additions & 81 deletions src/main/java/org/codehaus/mojo/flatten/AbstractFlattenMojo.java
Original file line number Diff line number Diff line change
@@ -1,81 +1,74 @@
package org.codehaus.mojo.flatten;

/*
* 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.File;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugins.annotations.Parameter;

/**
* This is the abstract base class for {@link AbstractMojo MOJOs} that realize the different goals of this plugin.
*
* @author Joerg Hohwiller (hohwille at users.sourceforge.net)
*/
public abstract class AbstractFlattenMojo
extends AbstractMojo
{

/**
* The directory where the generated flattened POM file will be written to.
*/
@Parameter( defaultValue = "${project.basedir}" )
private File outputDirectory;

/**
* The filename of the generated flattened POM file.
*/
@Parameter( property = "flattenedPomFilename", defaultValue = ".flattened-pom.xml" )
private String flattenedPomFilename;

/**
* The constructor.
*/
public AbstractFlattenMojo()
{

super();
}

/**
* @return the filename of the generated flattened POM file.
*/
public String getFlattenedPomFilename()
{
return this.flattenedPomFilename;
}

/**
* @return the directory where the generated flattened POM file will be written to.
*/
public File getOutputDirectory()
{
return this.outputDirectory;
}

/**
* @return a {@link File} instance pointing to the flattened POM.
*/
protected File getFlattenedPomFile()
{
return new File( getOutputDirectory(), getFlattenedPomFilename() );
}

}
package org.codehaus.mojo.flatten;

/*
* 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.File;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugins.annotations.Parameter;

/**
* This is the abstract base class for {@link AbstractMojo MOJOs} that realize the different goals of this plugin.
*
* @author Joerg Hohwiller (hohwille at users.sourceforge.net)
*/
public abstract class AbstractFlattenMojo extends AbstractMojo {

/**
* The directory where the generated flattened POM file will be written to.
*/
@Parameter(defaultValue = "${project.basedir}")
private File outputDirectory;

/**
* The filename of the generated flattened POM file.
*/
@Parameter(property = "flattenedPomFilename", defaultValue = ".flattened-pom.xml")
private String flattenedPomFilename;

/**
* The constructor.
*/
public AbstractFlattenMojo() {

super();
}

/**
* @return the filename of the generated flattened POM file.
*/
public String getFlattenedPomFilename() {
return this.flattenedPomFilename;
}

/**
* @return the directory where the generated flattened POM file will be written to.
*/
public File getOutputDirectory() {
return this.outputDirectory;
}

/**
* @return a {@link File} instance pointing to the flattened POM.
*/
protected File getFlattenedPomFile() {
return new File(getOutputDirectory(), getFlattenedPomFilename());
}
}
136 changes: 66 additions & 70 deletions src/main/java/org/codehaus/mojo/flatten/CleanMojo.java
Original file line number Diff line number Diff line change
@@ -1,70 +1,66 @@
package org.codehaus.mojo.flatten;

/*
* 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.File;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;

/**
* This MOJO realizes the goal <code>flatten:clean</code> that deletes any files created by
* <code>{@link FlattenMojo flatten:flatten}</code> (more specific the flattened POM file which is by default
* <code>.flattened-pom.xml</code>). See also <a href="http://jira.codehaus.org/browse/MOJO-2030">MOJO-2030</a> for
* further details.
*
* @author Joerg Hohwiller (hohwille at users.sourceforge.net)
* @since 1.0.0-beta-2
*/
@Mojo( name = "clean", requiresProject = true, requiresDirectInvocation = false, executionStrategy = "once-per-session",
threadSafe = true )
public class CleanMojo
extends AbstractFlattenMojo
{

/**
* The constructor.
*/
public CleanMojo()
{
super();
}

/**
* {@inheritDoc}
*/
public void execute()
throws MojoExecutionException, MojoFailureException
{

File flattenedPomFile = getFlattenedPomFile();
if ( flattenedPomFile.isFile() )
{
getLog().info( "Deleting " + flattenedPomFile.getPath() );
boolean deleted = flattenedPomFile.delete();
if ( !deleted )
{
throw new MojoFailureException( "Could not delete " + flattenedPomFile.getAbsolutePath() );
}
}
}

}
package org.codehaus.mojo.flatten;

/*
* 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.File;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;

/**
* This MOJO realizes the goal <code>flatten:clean</code> that deletes any files created by
* <code>{@link FlattenMojo flatten:flatten}</code> (more specific the flattened POM file which is by default
* <code>.flattened-pom.xml</code>). See also <a href="http://jira.codehaus.org/browse/MOJO-2030">MOJO-2030</a> for
* further details.
*
* @author Joerg Hohwiller (hohwille at users.sourceforge.net)
* @since 1.0.0-beta-2
*/
@Mojo(
name = "clean",
requiresProject = true,
requiresDirectInvocation = false,
executionStrategy = "once-per-session",
threadSafe = true)
public class CleanMojo extends AbstractFlattenMojo {

/**
* The constructor.
*/
public CleanMojo() {
super();
}

/**
* {@inheritDoc}
*/
public void execute() throws MojoExecutionException, MojoFailureException {

File flattenedPomFile = getFlattenedPomFile();
if (flattenedPomFile.isFile()) {
getLog().info("Deleting " + flattenedPomFile.getPath());
boolean deleted = flattenedPomFile.delete();
if (!deleted) {
throw new MojoFailureException("Could not delete " + flattenedPomFile.getAbsolutePath());
}
}
}
}
Loading

0 comments on commit 22993ef

Please sign in to comment.