- Created a maven-plugin to strip out any test-jars from deployment (not installation)
- Added the plugin to the parent pom so it is active for all artifacts
diff --git a/pom.xml b/pom.xml
index 383d5dc..ddd6b28 100644
--- a/pom.xml
+++ b/pom.xml
@@ -499,6 +499,21 @@
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.edgent.plugins</groupId>
+ <artifactId>edgent-deployment-filter-maven-plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>strip-test-jars</id>
+ <phase>install</phase>
+ <goals>
+ <goal>filter-test-jars</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
<!-- Configure the Site generation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/utils/edgent-deployment-filter-maven-plugin/pom.xml b/utils/edgent-deployment-filter-maven-plugin/pom.xml
new file mode 100644
index 0000000..4036b21
--- /dev/null
+++ b/utils/edgent-deployment-filter-maven-plugin/pom.xml
@@ -0,0 +1,134 @@
+<?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 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.
+
+-->
+<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>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>19</version>
+ </parent>
+
+ <groupId>org.apache.edgent.plugins</groupId>
+ <artifactId>edgent-deployment-filter-maven-plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+
+ <name>edgent-deployment-filter-maven-plugin Maven Plugin</name>
+
+ <!-- FIXME change it to the project's website -->
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>3.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>3.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>3.0.8</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>3.2</version>
+ <configuration>
+ <goalPrefix>edgent-deployment-filter-maven-plugin</goalPrefix>
+ <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
+ </configuration>
+ <executions>
+ <execution>
+ <id>mojo-descriptor</id>
+ <goals>
+ <goal>descriptor</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>run-its</id>
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.7</version>
+ <configuration>
+ <debug>true</debug>
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <pomIncludes>
+ <pomInclude>*/pom.xml</pomInclude>
+ </pomIncludes>
+ <postBuildHookScript>verify</postBuildHookScript>
+ <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <settingsFile>src/it/settings.xml</settingsFile>
+ <goals>
+ <goal>clean</goal>
+ <goal>test-compile</goal>
+ </goals>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/utils/edgent-deployment-filter-maven-plugin/src/it/settings.xml b/utils/edgent-deployment-filter-maven-plugin/src/it/settings.xml
new file mode 100644
index 0000000..14554cd
--- /dev/null
+++ b/utils/edgent-deployment-filter-maven-plugin/src/it/settings.xml
@@ -0,0 +1,53 @@
+<?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 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.
+
+-->
+<settings>
+ <profiles>
+ <profile>
+ <id>it-repo</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+</settings>
diff --git a/utils/edgent-deployment-filter-maven-plugin/src/it/simple-it/pom.xml b/utils/edgent-deployment-filter-maven-plugin/src/it/simple-it/pom.xml
new file mode 100644
index 0000000..aff476c
--- /dev/null
+++ b/utils/edgent-deployment-filter-maven-plugin/src/it/simple-it/pom.xml
@@ -0,0 +1,52 @@
+<?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 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.
+
+-->
+<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>
+
+ <groupId>org.apache.edgent.plugins.it</groupId>
+ <artifactId>simple-it</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <description>A simple IT verifying the basic use case.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>@project.artifactId@</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <id>touch</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>touch</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/utils/edgent-deployment-filter-maven-plugin/src/it/simple-it/verify.groovy b/utils/edgent-deployment-filter-maven-plugin/src/it/simple-it/verify.groovy
new file mode 100644
index 0000000..de904ae
--- /dev/null
+++ b/utils/edgent-deployment-filter-maven-plugin/src/it/simple-it/verify.groovy
@@ -0,0 +1,22 @@
+/*
+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.
+*/
+
+File touchFile = new File( basedir, "target/touch.txt" );
+
+assert touchFile.isFile()
diff --git a/utils/edgent-deployment-filter-maven-plugin/src/main/java/org/apache/edgent/plugins/deploymentfilter/DeploymentFilterMojo.java b/utils/edgent-deployment-filter-maven-plugin/src/main/java/org/apache/edgent/plugins/deploymentfilter/DeploymentFilterMojo.java
new file mode 100644
index 0000000..978b219
--- /dev/null
+++ b/utils/edgent-deployment-filter-maven-plugin/src/main/java/org/apache/edgent/plugins/deploymentfilter/DeploymentFilterMojo.java
@@ -0,0 +1,61 @@
+/*
+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.
+*/
+package org.apache.edgent.plugins.deploymentfilter;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Goal which filters all 'test-jar' artifacts from installation and deployment.
+ * The goal is added to the 'install' phase as this way it is executed after the install plugin,
+ * but before the deploy, which is the phase we don't want the artifact to be handled.
+ */
+@Mojo( name = "filter-test-jars", defaultPhase = LifecyclePhase.INSTALL )
+public class DeploymentFilterMojo
+ extends AbstractMojo
+{
+
+ @Parameter(defaultValue="${project}")
+ private MavenProject project;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ List<Artifact> toBeRemovedArtifacts = new LinkedList<Artifact>();
+ for(Artifact artifact : project.getAttachedArtifacts()) {
+ if("test-jar".equals(artifact.getType())) {
+ toBeRemovedArtifacts.add(artifact);
+ }
+ }
+ for(Artifact toBeRemovedArtifact : toBeRemovedArtifacts) {
+ getLog().info(" - Excluding test-jar artifact " + toBeRemovedArtifact.getArtifactId() +
+ " from deployment.");
+ project.getAttachedArtifacts().remove(toBeRemovedArtifact);
+ }
+ }
+}