You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by dl...@apache.org on 2018/02/12 15:56:03 UTC
[1/3] incubator-edgent git commit: - 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
Repository: incubator-edgent
Updated Branches:
refs/heads/develop ae28b030a -> 409d48b76
- 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
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/c522bdf6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/c522bdf6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/c522bdf6
Branch: refs/heads/develop
Commit: c522bdf6050e98f1b1e4e0fcec80f028cf78b13d
Parents: 95f28f0
Author: Christofer Dutz <ch...@c-ware.de>
Authored: Wed Jan 31 23:21:41 2018 +0100
Committer: Christofer Dutz <ch...@c-ware.de>
Committed: Wed Jan 31 23:21:41 2018 +0100
----------------------------------------------------------------------
pom.xml | 15 +++
.../pom.xml | 134 +++++++++++++++++++
.../src/it/settings.xml | 53 ++++++++
.../src/it/simple-it/pom.xml | 52 +++++++
.../src/it/simple-it/verify.groovy | 22 +++
.../deploymentfilter/DeploymentFilterMojo.java | 61 +++++++++
6 files changed, 337 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c522bdf6/pom.xml
----------------------------------------------------------------------
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>
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c522bdf6/utils/edgent-deployment-filter-maven-plugin/pom.xml
----------------------------------------------------------------------
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>
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c522bdf6/utils/edgent-deployment-filter-maven-plugin/src/it/settings.xml
----------------------------------------------------------------------
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>
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c522bdf6/utils/edgent-deployment-filter-maven-plugin/src/it/simple-it/pom.xml
----------------------------------------------------------------------
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>
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c522bdf6/utils/edgent-deployment-filter-maven-plugin/src/it/simple-it/verify.groovy
----------------------------------------------------------------------
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()
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c522bdf6/utils/edgent-deployment-filter-maven-plugin/src/main/java/org/apache/edgent/plugins/deploymentfilter/DeploymentFilterMojo.java
----------------------------------------------------------------------
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);
+ }
+ }
+}
[2/3] incubator-edgent git commit: - Added a testsuite for the plugin
- Some cleaning up and documenting of the code.
Posted by dl...@apache.org.
- Added a testsuite for the plugin
- Some cleaning up and documenting of the code.
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/c7185534
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/c7185534
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/c7185534
Branch: refs/heads/develop
Commit: c7185534d739265791d02a7b99a51aa074e3344d
Parents: c522bdf
Author: Christofer Dutz <ch...@c-ware.de>
Authored: Thu Feb 1 17:07:34 2018 +0100
Committer: Christofer Dutz <ch...@c-ware.de>
Committed: Thu Feb 1 17:07:34 2018 +0100
----------------------------------------------------------------------
pom.xml | 2 +-
.../pom.xml | 56 +++++++++----
.../src/it/simple-it/pom.xml | 52 ------------
.../src/it/simple-it/verify.groovy | 22 ------
.../src/it/with-plugin/pom.xml | 83 ++++++++++++++++++++
.../src/it/with-plugin/verify.groovy | 53 +++++++++++++
.../src/it/without-plugin/pom.xml | 67 ++++++++++++++++
.../src/it/without-plugin/verify.groovy | 53 +++++++++++++
.../deploymentfilter/DeploymentFilterMojo.java | 61 --------------
.../deploymentfilter/FilterTestJarsMojo.java | 68 ++++++++++++++++
10 files changed, 364 insertions(+), 153 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c7185534/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ddd6b28..bbe6867 100644
--- a/pom.xml
+++ b/pom.xml
@@ -505,7 +505,7 @@
<version>1.0.0-SNAPSHOT</version>
<executions>
<execution>
- <id>strip-test-jars</id>
+ <id>filter-test-jars</id>
<phase>install</phase>
<goals>
<goal>filter-test-jars</goal>
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c7185534/utils/edgent-deployment-filter-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/utils/edgent-deployment-filter-maven-plugin/pom.xml b/utils/edgent-deployment-filter-maven-plugin/pom.xml
index 4036b21..a3ed058 100644
--- a/utils/edgent-deployment-filter-maven-plugin/pom.xml
+++ b/utils/edgent-deployment-filter-maven-plugin/pom.xml
@@ -77,7 +77,7 @@
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<configuration>
- <goalPrefix>edgent-deployment-filter-maven-plugin</goalPrefix>
+ <goalPrefix>edgent-deployment-filter</goalPrefix>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
@@ -95,39 +95,61 @@
<profile>
<id>run-its</id>
<build>
-
<plugins>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>mrm-maven-plugin</artifactId>
+ <version>1.1.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>start</goal>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <propertyName>mrm.distribution.url</propertyName>
+ <repositories>
+ <hostedRepo>
+ <target>${project.build.directory}/maven-repos/remote</target>
+ </hostedRepo>
+ </repositories>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
- <version>1.7</version>
+ <version>3.0.1</version>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
<configuration>
- <debug>true</debug>
+ <debug>false</debug>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<pomIncludes>
<pomInclude>*/pom.xml</pomInclude>
</pomIncludes>
<postBuildHookScript>verify</postBuildHookScript>
- <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <localRepositoryPath>${project.build.directory}/maven-repos/local</localRepositoryPath>
<settingsFile>src/it/settings.xml</settingsFile>
<goals>
<goal>clean</goal>
- <goal>test-compile</goal>
+ <goal>deploy</goal>
</goals>
+ <filterProperties>
+ <mrm.distribution.url>${mrm.distribution.url}</mrm.distribution.url>
+ </filterProperties>
</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>
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c7185534/utils/edgent-deployment-filter-maven-plugin/src/it/simple-it/pom.xml
----------------------------------------------------------------------
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
deleted file mode 100644
index aff476c..0000000
--- a/utils/edgent-deployment-filter-maven-plugin/src/it/simple-it/pom.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?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>
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c7185534/utils/edgent-deployment-filter-maven-plugin/src/it/simple-it/verify.groovy
----------------------------------------------------------------------
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
deleted file mode 100644
index de904ae..0000000
--- a/utils/edgent-deployment-filter-maven-plugin/src/it/simple-it/verify.groovy
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-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()
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c7185534/utils/edgent-deployment-filter-maven-plugin/src/it/with-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/utils/edgent-deployment-filter-maven-plugin/src/it/with-plugin/pom.xml b/utils/edgent-deployment-filter-maven-plugin/src/it/with-plugin/pom.xml
new file mode 100644
index 0000000..b59f56f
--- /dev/null
+++ b/utils/edgent-deployment-filter-maven-plugin/src/it/with-plugin/pom.xml
@@ -0,0 +1,83 @@
+<?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.it</groupId>
+ <artifactId>with-plugin</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>
+
+ <distributionManagement>
+ <repository>
+ <id>mrm</id>
+ <url>@mrm.distribution.url@</url>
+ </repository>
+ <snapshotRepository>
+ <id>mrm</id>
+ <url>@mrm.distribution.url@</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <build>
+ <plugins>
+ <!-- Create a test-jar -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Ensure it's not deployed -->
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>@project.artifactId@</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <id>filter-test-jars</id>
+ <phase>install</phase>
+ <goals>
+ <goal>filter-test-jars</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c7185534/utils/edgent-deployment-filter-maven-plugin/src/it/with-plugin/verify.groovy
----------------------------------------------------------------------
diff --git a/utils/edgent-deployment-filter-maven-plugin/src/it/with-plugin/verify.groovy b/utils/edgent-deployment-filter-maven-plugin/src/it/with-plugin/verify.groovy
new file mode 100644
index 0000000..c376a30
--- /dev/null
+++ b/utils/edgent-deployment-filter-maven-plugin/src/it/with-plugin/verify.groovy
@@ -0,0 +1,53 @@
+/*
+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 groovy.io.FileType
+
+def jarFile = new File(basedir, "target/with-plugin-1.0-SNAPSHOT.jar")
+def testJarFile = new File(basedir, "target/with-plugin-1.0-SNAPSHOT-tests.jar")
+
+// The jar file should exist
+assert jarFile.exists() && jarFile.isFile()
+
+// The test-jar should also exist
+assert testJarFile.exists() && testJarFile.isFile()
+
+// The local repo should contain the test-jar.
+def jarLocalRepo = new File("target/maven-repos/local/org/apache/edgent/plugins/it/with-plugin/1.0-SNAPSHOT")
+assert jarLocalRepo.exists()
+def foundTestJarInLocal = false
+jarLocalRepo.eachFileRecurse (FileType.FILES) { file ->
+ println file.name
+ if(file.name.endsWith("tests.jar")) {
+ foundTestJarInLocal = true
+ }
+}
+assert foundTestJarInLocal
+
+// The remote repo shouldn't contain it.
+def jarRemoteRepo = new File("target/maven-repos/remote/org/apache/edgent/plugins/it/with-plugin/1.0-SNAPSHOT")
+assert jarRemoteRepo.exists()
+def foundTestJarInRemote = false
+jarRemoteRepo.eachFileRecurse (FileType.FILES) { file ->
+ println file.name
+ if(file.name.endsWith("tests.jar")) {
+ foundTestJarInRemote = true
+ }
+}
+assert !foundTestJarInRemote
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c7185534/utils/edgent-deployment-filter-maven-plugin/src/it/without-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/utils/edgent-deployment-filter-maven-plugin/src/it/without-plugin/pom.xml b/utils/edgent-deployment-filter-maven-plugin/src/it/without-plugin/pom.xml
new file mode 100644
index 0000000..cea659b
--- /dev/null
+++ b/utils/edgent-deployment-filter-maven-plugin/src/it/without-plugin/pom.xml
@@ -0,0 +1,67 @@
+<?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.it</groupId>
+ <artifactId>without-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <description>A simple IT verifying a build without the plugin.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <distributionManagement>
+ <repository>
+ <id>mrm</id>
+ <url>@mrm.distribution.url@</url>
+ </repository>
+ <snapshotRepository>
+ <id>mrm</id>
+ <url>@mrm.distribution.url@</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <build>
+ <plugins>
+ <!-- Create a test-jar -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c7185534/utils/edgent-deployment-filter-maven-plugin/src/it/without-plugin/verify.groovy
----------------------------------------------------------------------
diff --git a/utils/edgent-deployment-filter-maven-plugin/src/it/without-plugin/verify.groovy b/utils/edgent-deployment-filter-maven-plugin/src/it/without-plugin/verify.groovy
new file mode 100644
index 0000000..e294108
--- /dev/null
+++ b/utils/edgent-deployment-filter-maven-plugin/src/it/without-plugin/verify.groovy
@@ -0,0 +1,53 @@
+/*
+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 groovy.io.FileType
+
+def jarFile = new File(basedir, "target/without-plugin-1.0-SNAPSHOT.jar")
+def testJarFile = new File(basedir, "target/without-plugin-1.0-SNAPSHOT-tests.jar")
+
+// The jar file should exist
+assert jarFile.exists() && jarFile.isFile()
+
+// The test-jar should also exist
+assert testJarFile.exists() && testJarFile.isFile()
+
+// The local repo should contain the test-jar.
+def jarLocalRepo = new File("target/maven-repos/local/org/apache/edgent/plugins/it/without-plugin/1.0-SNAPSHOT")
+assert jarLocalRepo.exists()
+def foundTestJarInLocal = false
+jarLocalRepo.eachFileRecurse (FileType.FILES) { file ->
+ println file.name
+ if(file.name.endsWith("tests.jar")) {
+ foundTestJarInLocal = true
+ }
+}
+assert foundTestJarInLocal
+
+// The remote repo should contain it too.
+def jarRemoteRepo = new File("target/maven-repos/remote/org/apache/edgent/plugins/it/without-plugin/1.0-SNAPSHOT")
+assert jarRemoteRepo.exists()
+def foundTestJarInRemote = false
+jarRemoteRepo.eachFileRecurse (FileType.FILES) { file ->
+ println file.name
+ if(file.name.endsWith("tests.jar")) {
+ foundTestJarInRemote = true
+ }
+}
+assert foundTestJarInRemote
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c7185534/utils/edgent-deployment-filter-maven-plugin/src/main/java/org/apache/edgent/plugins/deploymentfilter/DeploymentFilterMojo.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 978b219..0000000
--- a/utils/edgent-deployment-filter-maven-plugin/src/main/java/org/apache/edgent/plugins/deploymentfilter/DeploymentFilterMojo.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-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);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c7185534/utils/edgent-deployment-filter-maven-plugin/src/main/java/org/apache/edgent/plugins/deploymentfilter/FilterTestJarsMojo.java
----------------------------------------------------------------------
diff --git a/utils/edgent-deployment-filter-maven-plugin/src/main/java/org/apache/edgent/plugins/deploymentfilter/FilterTestJarsMojo.java b/utils/edgent-deployment-filter-maven-plugin/src/main/java/org/apache/edgent/plugins/deploymentfilter/FilterTestJarsMojo.java
new file mode 100644
index 0000000..7e90550
--- /dev/null
+++ b/utils/edgent-deployment-filter-maven-plugin/src/main/java/org/apache/edgent/plugins/deploymentfilter/FilterTestJarsMojo.java
@@ -0,0 +1,68 @@
+/*
+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 FilterTestJarsMojo
+ extends AbstractMojo
+{
+
+ @Parameter(defaultValue="${project}")
+ private MavenProject project;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ // Find all 'test-jar' artifacts.
+ // (This has to be done in separate loops in order to prevent
+ // concurrent modification exceptions.
+ List<Artifact> toBeRemovedArtifacts = new LinkedList<Artifact>();
+ for(Artifact artifact : project.getAttachedArtifacts()) {
+ if("test-jar".equals(artifact.getType())) {
+ toBeRemovedArtifacts.add(artifact);
+ }
+ }
+
+ // Remove all of them from the list of attached artifacts.
+ if(!toBeRemovedArtifacts.isEmpty()) {
+ for (Artifact toBeRemovedArtifact : toBeRemovedArtifacts) {
+ getLog().info(" - Excluding test-jar artifact " + toBeRemovedArtifact.getArtifactId() +
+ " from deployment.");
+ project.getAttachedArtifacts().remove(toBeRemovedArtifact);
+ }
+ }
+ }
+}
[3/3] incubator-edgent git commit: Merge pull request #344
Posted by dl...@apache.org.
Merge pull request #344
This closes #344
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/409d48b7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/409d48b7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/409d48b7
Branch: refs/heads/develop
Commit: 409d48b76d9964b2aa9698d67513db44805eba2c
Parents: ae28b03 c718553
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Mon Feb 12 10:55:54 2018 -0500
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Mon Feb 12 10:55:54 2018 -0500
----------------------------------------------------------------------
pom.xml | 15 ++
.../pom.xml | 156 +++++++++++++++++++
.../src/it/settings.xml | 53 +++++++
.../src/it/with-plugin/pom.xml | 83 ++++++++++
.../src/it/with-plugin/verify.groovy | 53 +++++++
.../src/it/without-plugin/pom.xml | 67 ++++++++
.../src/it/without-plugin/verify.groovy | 53 +++++++
.../deploymentfilter/FilterTestJarsMojo.java | 68 ++++++++
8 files changed, 548 insertions(+)
----------------------------------------------------------------------