Skip to content

Commit

Permalink
[MRESOURCES-297] Update to parent POM 39, reformat (#55)
Browse files Browse the repository at this point in the history
Slight change introduced in src/it/includeEmptyDirs that used
".gitattributes" as placeholder, but that file is not excluded
anymore with latest plexus-utils. Sources and javadoc
adapted, IT fixed to use "._placeholder" instead.

---

https://issues.apache.org/jira/browse/MRESOURCES-297
  • Loading branch information
cstamas authored Mar 21, 2023
1 parent 22d64ca commit f7a6f22
Show file tree
Hide file tree
Showing 19 changed files with 819 additions and 1,094 deletions.
55 changes: 32 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version='1.0' encoding='UTF-8'?>

<?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
Expand All @@ -18,40 +17,43 @@ 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>

<parent>
<artifactId>maven-plugins</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>36</version>
<artifactId>maven-plugins</artifactId>
<version>39</version>
</parent>

<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1-SNAPSHOT</version>
<packaging>maven-plugin</packaging>

<name>Apache Maven Resources Plugin</name>
<description>
The Resources Plugin handles the copying of project resources to the output
<description>The Resources Plugin handles the copying of project resources to the output
directory. There are two different kinds of resources: main resources and test resources. The
difference is that the main resources are the resources associated with the main
source code while the test resources are associated with the test source code.
Thus, this allows the separation of resources for the main source code and its
unit tests.
</description>
unit tests.</description>
<inceptionYear>2001</inceptionYear>

<contributors>
<contributor>
<name>Graham Leggett</name>
</contributor>
</contributors>

<prerequisites>
<maven>${mavenVersion}</maven>
</prerequisites>

<scm>
<connection>scm:git:https://gitbox.apache.org/repos/asf/maven-resources-plugin.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-resources-plugin.git</developerConnection>
<url>https://github.com/apache/maven-resources-plugin/tree/${project.scm.tag}</url>
<tag>HEAD</tag>
<url>https://github.com/apache/maven-resources-plugin/tree/${project.scm.tag}</url>
</scm>
<issueManagement>
<system>JIRA</system>
Expand All @@ -75,12 +77,6 @@ under the License.
<project.build.outputTimestamp>2022-07-23T17:49:18Z</project.build.outputTimestamp>
</properties>

<contributors>
<contributor>
<name>Graham Leggett</name>
</contributor>
</contributors>

<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
Expand Down Expand Up @@ -123,6 +119,11 @@ under the License.
<version>0.3.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
Expand Down Expand Up @@ -160,21 +161,29 @@ under the License.
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-api</artifactId>
<version>1.6.3</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes combine.children="append">
<!-- ITs and IT resources -->
<exclude>src/it/**</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>run-its</id>
Expand Down
3 changes: 3 additions & 0 deletions src/it/includeEmptyDirs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Note: this file uses ".git" named files as placeholders, that are part of "default excludes" in plexus-utils.
Before, this IT used ".gitattributes" file, but it was removed from set of default excludes by this
commit: https://github.com/codehaus-plexus/plexus-utils/commit/e8a8433894eae9e8f82cbba4b903508362e9322a
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.apache.maven.plugins.resources;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,73 +16,64 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.plugins.resources;

import java.io.File;
import java.util.List;

import org.apache.maven.model.Resource;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

import java.io.File;
import java.util.List;

/**
* Copy resources of the configured plugin attribute resources
*
*
* @author Olivier Lamy
* @since 2.3
*/
@Mojo( name = "copy-resources", threadSafe = true )
public class CopyResourcesMojo
extends ResourcesMojo
{

@Mojo(name = "copy-resources", threadSafe = true)
public class CopyResourcesMojo extends ResourcesMojo {

/**
* The output directory into which to copy the resources.
*/
@Parameter( required = true )
@Parameter(required = true)
private File outputDirectory;

/**
* The list of resources we want to transfer. See the Maven Model for a
* description of how to code the resources element.
*/
@Parameter( required = true )
@Parameter(required = true)
private List<Resource> resources;


/** {@inheritDoc} */
public File getOutputDirectory()
{
public File getOutputDirectory() {
return outputDirectory;
}

/** {@inheritDoc} */
public void setOutputDirectory( File outputDirectory )
{
public void setOutputDirectory(File outputDirectory) {
this.outputDirectory = outputDirectory;
}

/** {@inheritDoc} */
public List<Resource> getResources()
{
public List<Resource> getResources() {
return resources;
}

/** {@inheritDoc} */
public void setResources( List<Resource> resources )
{
public void setResources(List<Resource> resources) {
this.resources = resources;
}

/** {@inheritDoc} */
public List<String> getFilters()
{
public List<String> getFilters() {
return filters;
}

/** {@inheritDoc} */
public void setFilters( List<String> filters )
{
public void setFilters(List<String> filters) {
this.filters = filters;
}

}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.apache.maven.plugins.resources;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -9,7 +7,7 @@
* "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
* 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
Expand All @@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.plugins.resources;

import java.text.SimpleDateFormat;
import java.util.Date;
Expand All @@ -28,8 +27,7 @@
/**
* This class is duplicated from maven-model-builder from maven core. (See MRESOURCES-99).
*/
public class MavenBuildTimestamp
{
public class MavenBuildTimestamp {
/**
* ISO 8601-compliant timestamp for machine readability
*/
Expand All @@ -43,71 +41,59 @@ public class MavenBuildTimestamp
/**
* The default time zone {@code Etc/UTC}.
*/
public static final TimeZone DEFAULT_BUILD_TIME_ZONE = TimeZone.getTimeZone( "Etc/UTC" );
public static final TimeZone DEFAULT_BUILD_TIME_ZONE = TimeZone.getTimeZone("Etc/UTC");

private String formattedTimestamp;

/**
* Create an instance.
*/
public MavenBuildTimestamp()
{
this( new Date() );
public MavenBuildTimestamp() {
this(new Date());
}

/**
* @param time The time to use.
*/
public MavenBuildTimestamp( Date time )
{
this( time, DEFAULT_BUILD_TIMESTAMP_FORMAT );
public MavenBuildTimestamp(Date time) {
this(time, DEFAULT_BUILD_TIMESTAMP_FORMAT);
}

/**
* @param time The time to use.
* @param properties the properties which can be define. can be {@code null}
*/
public MavenBuildTimestamp( Date time, Properties properties )
{
this( time, properties != null ? properties.getProperty( BUILD_TIMESTAMP_FORMAT_PROPERTY ) : null );
public MavenBuildTimestamp(Date time, Properties properties) {
this(time, properties != null ? properties.getProperty(BUILD_TIMESTAMP_FORMAT_PROPERTY) : null);
}

/**
* @param time The time to use.
* @param timestampFormat The format for {@link SimpleDateFormat}.
*/
public MavenBuildTimestamp( Date time, String timestampFormat )
{
public MavenBuildTimestamp(Date time, String timestampFormat) {
SimpleDateFormat dateFormat;

if ( timestampFormat == null )
{
dateFormat = new SimpleDateFormat( DEFAULT_BUILD_TIMESTAMP_FORMAT );
}
else
{
dateFormat = new SimpleDateFormat( timestampFormat );
if (timestampFormat == null) {
dateFormat = new SimpleDateFormat(DEFAULT_BUILD_TIMESTAMP_FORMAT);
} else {
dateFormat = new SimpleDateFormat(timestampFormat);
}

dateFormat.setCalendar( new GregorianCalendar() );
dateFormat.setTimeZone( DEFAULT_BUILD_TIME_ZONE );
dateFormat.setCalendar(new GregorianCalendar());
dateFormat.setTimeZone(DEFAULT_BUILD_TIME_ZONE);

if ( time == null )
{
formattedTimestamp = dateFormat.format( new Date() );
}
else
{
formattedTimestamp = dateFormat.format( time );
if (time == null) {
formattedTimestamp = dateFormat.format(new Date());
} else {
formattedTimestamp = dateFormat.format(time);
}

}

/**
* @return The formatted time stamp.
*/
public String formattedTimestamp()
{
public String formattedTimestamp() {
return formattedTimestamp;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.apache.maven.plugins.resources;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,15 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.plugins.resources;

/**
* @author Olivier Lamy
* @since 2.3
*
*/
public class Resource
extends org.apache.maven.model.Resource
{
public class Resource extends org.apache.maven.model.Resource {
// nothing to do here just a class prevent users adding an implementation attribute
// in the mojo configuration
}
Loading

0 comments on commit f7a6f22

Please sign in to comment.