-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable spotless plugin - automatic code formatting - reformat
- Loading branch information
1 parent
e9fcdaf
commit 22993ef
Showing
23 changed files
with
2,989 additions
and
3,652 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
|
||
|
@@ -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> | ||
|
@@ -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> | ||
|
||
|
@@ -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> | ||
|
@@ -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> | ||
|
@@ -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> | ||
|
@@ -335,6 +325,14 @@ | |
<proxyRepo /> | ||
</repositories> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>start</goal> | ||
<goal>stop</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
155 changes: 74 additions & 81 deletions
155
src/main/java/org/codehaus/mojo/flatten/AbstractFlattenMojo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.