Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
slachiewicz committed Jun 16, 2024
1 parent 618dc54 commit 2567b54
Show file tree
Hide file tree
Showing 36 changed files with 753 additions and 1,241 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ This is the [wagon-maven-plugin](http://www.mojohaus.org/wagon-maven-plugin/).
[![Apache License 2](https://img.shields.io/badge/wagon-Apache_v2-yellow.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt)
[![GitHub CI](https://github.com/mojohaus/wagon-maven-plugin/actions/workflows/maven.yml/badge.svg)](https://github.com/mojohaus/wagon-maven-plugin/actions/workflows/maven.yml)


## Maintained versions

Wagen Maven Plugin requires Maven 3.6.3+ and JDK 8+
Expand Down Expand Up @@ -81,3 +80,4 @@ cd target/checkout
../mvnw site
../mvnw scm-publish:publish-scm
```

109 changes: 34 additions & 75 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>mojo-parent</artifactId>
<groupId>org.codehaus.mojo</groupId>
<artifactId>mojo-parent</artifactId>
<version>84</version>
</parent>

Expand All @@ -13,33 +13,19 @@
<packaging>maven-plugin</packaging>
<name>Wagon Maven Plugin</name>

<description>
Maven plugin that can be used to access various operations on a given URL using a supported maven wagon. Supports
recursive upload, download, and list directory content functionality.
</description>
<url>http://www.mojohaus.org/wagon-maven-plugin/</url>
<description>Maven plugin that can be used to access various operations on a given URL using a supported maven wagon. Supports
recursive upload, download, and list directory content functionality.</description>
<url>https://www.mojohaus.org/wagon-maven-plugin/</url>

<inceptionYear>2008</inceptionYear>

<prerequisites>
<maven>3.0</maven>
</prerequisites>

<scm>
<connection>scm:git:https://github.com/mojohaus/wagon-maven-plugin.git</connection>
<developerConnection>scm:git:ssh://git@github.com/mojohaus/wagon-maven-plugin.git</developerConnection>
<url>https://github.com/mojohaus/wagon-maven-plugin/</url>
<tag>HEAD</tag>
</scm>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/mojohaus/wagon-maven-plugin/issues/</url>
</issueManagement>
<ciManagement>
<system>Travis-CI</system>
<url>https://travis-ci.org/mojohaus/wagon-maven-plugin</url>
</ciManagement>
<licenses>
<license>
<name>Apache License 2</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
Expand All @@ -61,29 +47,40 @@
</roles>
</developer>
<developer>
<name>Tony Chemit</name>
<id>tchemit</id>
<name>Tony Chemit</name>
<email>dev@tchemit.fr</email>
<organization>Ultreia.io</organization>
<organizationUrl>https://www.ultreia.io</organizationUrl>
<email>dev@tchemit.fr</email>
<timezone>Europe/Paris</timezone>
<roles>
<role>Developer</role>
</roles>
<timezone>Europe/Paris</timezone>
</developer>
</developers>

<licenses>
<license>
<name>Apache License 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<prerequisites>
<maven>3.6.3</maven>
</prerequisites>

<scm>
<connection>scm:git:https://github.com/mojohaus/wagon-maven-plugin.git</connection>
<developerConnection>scm:git:ssh://git@github.com/mojohaus/wagon-maven-plugin.git</developerConnection>
<tag>HEAD</tag>
<url>https://github.com/mojohaus/wagon-maven-plugin/</url>
</scm>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/mojohaus/wagon-maven-plugin/issues/</url>
</issueManagement>
<ciManagement>
<system>GitHub</system>
<url>https://github.com/mojohaus/wagon-maven-plugin/actions</url>
</ciManagement>

<properties>
<maven.api.version>3.6.3</maven.api.version>
<mojo.java.target>8</mojo.java.target>
<wagon.api.version>3.4.0</wagon.api.version>

<!-- Test plugins -->
Expand Down Expand Up @@ -134,12 +131,6 @@
<artifactId>maven-core</artifactId>
<version>${maven.api.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -173,12 +164,6 @@
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>${wagon.api.version}</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -257,32 +242,6 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-maven-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>descriptor</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>false</runOnIncremental>
</execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<configuration>
Expand Down Expand Up @@ -329,10 +288,10 @@
<executions>
<execution>
<id>testProperties</id>
<phase>process-test-resources</phase>
<goals>
<goal>testProperties</goal>
</goals>
<phase>process-test-resources</phase>
</execution>
</executions>
</plugin>
Expand Down
56 changes: 19 additions & 37 deletions src/main/java/org/codehaus/mojo/wagon/AbstractCopyMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,58 +26,40 @@
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.WagonException;

public abstract class AbstractCopyMojo
extends AbstractDoubleWagonMojo
{
public abstract class AbstractCopyMojo extends AbstractDoubleWagonMojo {

protected abstract void copy( Wagon src, Wagon target )
throws IOException, WagonException;
protected abstract void copy(Wagon src, Wagon target) throws IOException, WagonException;

@Override
public void execute()
throws MojoExecutionException
{
public void execute() throws MojoExecutionException {

if ( this.skip )
{
this.getLog().info( "Skip execution." );
if (this.skip) {
this.getLog().info("Skip execution.");
return;
}

Wagon srcWagon = null;
Wagon targetWagon = null;

try
{
srcWagon = createWagon( sourceId, source );
targetWagon = createWagon( targetId, target );
copy( srcWagon, targetWagon );
try {
srcWagon = createWagon(sourceId, source);
targetWagon = createWagon(targetId, target);
copy(srcWagon, targetWagon);
} catch (Exception e) {
throw new MojoExecutionException("Error during performing repository copy", e);
} finally {
disconnectWagon(srcWagon);
disconnectWagon(targetWagon);
}
catch ( Exception e )
{
throw new MojoExecutionException( "Error during performing repository copy", e );
}
finally
{
disconnectWagon( srcWagon );
disconnectWagon( targetWagon );
}

}

private void disconnectWagon( Wagon wagon )
{
try
{
if ( wagon != null )
{
private void disconnectWagon(Wagon wagon) {
try {
if (wagon != null) {
wagon.disconnect();
}
}
catch ( ConnectionException e )
{
getLog().debug( "Error disconnecting wagon - ignored", e );
} catch (ConnectionException e) {
getLog().debug("Error disconnecting wagon - ignored", e);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,38 @@
/**
* Provides base functionality for dealing with I/O using single wagon.
*/
public abstract class AbstractDoubleWagonMojo
extends AbstractWagonMojo
{
public abstract class AbstractDoubleWagonMojo extends AbstractWagonMojo {

/**
* The URL to the source repository.
*/
@Parameter( property = "wagon.source", required = true)
@Parameter(property = "wagon.source", required = true)
protected String source;

/**
* The URL to the target repository.
*/
@Parameter( property = "wagon.target", required = true)
@Parameter(property = "wagon.target", required = true)
protected String target;

/**
* settings.xml's server id of the source repository. This is used when wagon needs extra authentication
* information.
*/
@Parameter( property = "wagon.sourceId", defaultValue = "source")
@Parameter(property = "wagon.sourceId", defaultValue = "source")
protected String sourceId;

/**
* settings.xml's server id of the target repository. This is used when wagon needs extra authentication
* information.
*/
@Parameter( property = "wagon.targetId", defaultValue = "target")
@Parameter(property = "wagon.targetId", defaultValue = "target")
protected String targetId;

/**
* Optimize the upload by locally compressed all files in one bundle, upload the bundle, and finally remote
* uncompress the bundle. This only works with SCP's URL
*/
@Parameter( property = "wagon.optimize", defaultValue = "false")
@Parameter(property = "wagon.optimize", defaultValue = "false")
protected boolean optimize = false;

}
Loading

0 comments on commit 2567b54

Please sign in to comment.