CAY-2304 Custom ClassLoader for Maven and Gradle plugins
  minor cleanup

Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/17063b89
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/17063b89
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/17063b89

Branch: refs/heads/master
Commit: 17063b89f1fe8fb28c5790e2db74b50f3c48f03d
Parents: 813f206
Author: Nikita Timofeev <stari...@gmail.com>
Authored: Wed Apr 11 15:32:24 2018 +0300
Committer: Nikita Timofeev <stari...@gmail.com>
Committed: Wed Apr 11 15:32:24 2018 +0300

----------------------------------------------------------------------
 RELEASE-NOTES.txt                               |  2 +-
 .../tools/GradlePluginClassLoaderManager.java   |  3 +-
 .../org/apache/cayenne/tools/DbImportIT.java    |  2 +-
 .../dbimport-with-project-dependency.gradle     | 44 ++++++++++++++++++++
 .../org/apache/cayenne/tools/my-test.gradle     | 44 --------------------
 maven-plugins/cayenne-maven-plugin/pom.xml      |  4 +-
 .../apache/cayenne/tools/DbImporterMojo.java    |  5 ++-
 .../org/apache/cayenne/stubs/ArtifactStub.java  | 18 ++++++++
 .../cayenne/stubs/CayenneProjectStub.java       | 18 ++++++++
 .../cayenne/tools/DbImporterMojoTest.java       |  2 -
 10 files changed, 89 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/17063b89/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index bf9dbd0..a619bcc 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -13,7 +13,7 @@ Date:
 ----------------------------------
 Changes/New Features:
 
-CAY-2304 Add updating maven and gradle plugins class loaders with project 
dependencies to remove dependency duplication in configuration files.
+CAY-2304 Custom ClassLoader for Maven and Gradle plugins that use project 
dependencies
 CAY-2334 cgen: option to force run from maven/gradle
 CAY-2337 Save reverse engineering configuration with datamap XML
 CAY-2372 Extract new modules from cayenne-server

http://git-wip-us.apache.org/repos/asf/cayenne/blob/17063b89/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/GradlePluginClassLoaderManager.java
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/GradlePluginClassLoaderManager.java
 
b/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/GradlePluginClassLoaderManager.java
index 898d0f1..64883b3 100644
--- 
a/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/GradlePluginClassLoaderManager.java
+++ 
b/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/GradlePluginClassLoaderManager.java
@@ -57,12 +57,11 @@ public class GradlePluginClassLoaderManager implements 
ClassLoaderManager {
             return;
         }
 
-        configuration.files(dependency).forEach(file -> addUrlFromFile(file));
+        configuration.files(dependency).forEach(this::addUrlFromFile);
     }
 
     private void addUrlFromFile(final File file) {
         try {
-            System.out.println("Add URI to classpath: " + file.toURI());
             urls.add(file.toURI().toURL());
         } catch (Exception ignored) {
         }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/17063b89/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbImportIT.java
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbImportIT.java 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbImportIT.java
index e3bbf6c..9753d8e 100644
--- 
a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbImportIT.java
+++ 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbImportIT.java
@@ -70,7 +70,7 @@ public class DbImportIT extends BaseTaskIT {
 
     @Test
     public void emptyDbTaskWithDependency() throws Exception {
-        GradleRunner runner = createRunner("my-test", "cdbimport", "--info");
+        GradleRunner runner = createRunner("dbimport-with-project-dependency", 
"cdbimport", "--info");
 
         BuildResult result = runner.build();
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/17063b89/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport-with-project-dependency.gradle
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport-with-project-dependency.gradle
 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport-with-project-dependency.gradle
new file mode 100644
index 0000000..7b74f37
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport-with-project-dependency.gradle
@@ -0,0 +1,44 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+plugins {
+    id 'org.apache.cayenne'
+}
+apply plugin:'java'
+cdbimport {
+    map 'datamap.map.xml'
+
+    adapter 'org.apache.cayenne.dba.derby.DerbyAdapter'
+
+    dataSource {
+        username 'sa'
+        password ''
+        url 'jdbc:derby:build/testdb;create=true'
+        driver 'org.apache.derby.jdbc.EmbeddedDriver'
+    }
+}
+
+dependencies {
+    compile 'mysql:mysql-connector-java:6.0.5'
+}
+
+repositories {
+    mavenLocal()
+    mavenCentral()
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/17063b89/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/my-test.gradle
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/my-test.gradle
 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/my-test.gradle
deleted file mode 100644
index 7b74f37..0000000
--- 
a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/my-test.gradle
+++ /dev/null
@@ -1,44 +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.
- ****************************************************************/
-
-plugins {
-    id 'org.apache.cayenne'
-}
-apply plugin:'java'
-cdbimport {
-    map 'datamap.map.xml'
-
-    adapter 'org.apache.cayenne.dba.derby.DerbyAdapter'
-
-    dataSource {
-        username 'sa'
-        password ''
-        url 'jdbc:derby:build/testdb;create=true'
-        driver 'org.apache.derby.jdbc.EmbeddedDriver'
-    }
-}
-
-dependencies {
-    compile 'mysql:mysql-connector-java:6.0.5'
-}
-
-repositories {
-    mavenLocal()
-    mavenCentral()
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/17063b89/maven-plugins/cayenne-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/pom.xml 
b/maven-plugins/cayenne-maven-plugin/pom.xml
index a66bb21..93d8164 100644
--- a/maven-plugins/cayenne-maven-plugin/pom.xml
+++ b/maven-plugins/cayenne-maven-plugin/pom.xml
@@ -13,8 +13,8 @@
 
        <parent>
                <artifactId>cayenne-maven-plugins-parent</artifactId>
-                       <groupId>org.apache.cayenne.plugins</groupId>
-                       <version>4.1.M2-SNAPSHOT</version>
+               <groupId>org.apache.cayenne.plugins</groupId>
+               <version>4.1.M2-SNAPSHOT</version>
        </parent>
 
        <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/17063b89/maven-plugins/cayenne-maven-plugin/src/main/java/org/apache/cayenne/tools/DbImporterMojo.java
----------------------------------------------------------------------
diff --git 
a/maven-plugins/cayenne-maven-plugin/src/main/java/org/apache/cayenne/tools/DbImporterMojo.java
 
b/maven-plugins/cayenne-maven-plugin/src/main/java/org/apache/cayenne/tools/DbImporterMojo.java
index 61e36e7..1c2d601 100644
--- 
a/maven-plugins/cayenne-maven-plugin/src/main/java/org/apache/cayenne/tools/DbImporterMojo.java
+++ 
b/maven-plugins/cayenne-maven-plugin/src/main/java/org/apache/cayenne/tools/DbImporterMojo.java
@@ -30,7 +30,10 @@ import org.apache.cayenne.di.ClassLoaderManager;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
 import org.apache.cayenne.util.Util;
-import org.apache.maven.plugins.annotations.*;
+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.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
 import org.slf4j.Logger;
 import org.apache.maven.plugin.AbstractMojo;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/17063b89/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/stubs/ArtifactStub.java
----------------------------------------------------------------------
diff --git 
a/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/stubs/ArtifactStub.java
 
b/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/stubs/ArtifactStub.java
index 34a0e20..79a5ca1 100644
--- 
a/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/stubs/ArtifactStub.java
+++ 
b/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/stubs/ArtifactStub.java
@@ -1,3 +1,21 @@
+/*****************************************************************
+ *   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.cayenne.stubs;
 
 import org.apache.maven.artifact.DefaultArtifact;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/17063b89/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/stubs/CayenneProjectStub.java
----------------------------------------------------------------------
diff --git 
a/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/stubs/CayenneProjectStub.java
 
b/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/stubs/CayenneProjectStub.java
index 36dd95a..da554b3 100644
--- 
a/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/stubs/CayenneProjectStub.java
+++ 
b/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/stubs/CayenneProjectStub.java
@@ -1,3 +1,21 @@
+/*****************************************************************
+ *   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.cayenne.stubs;
 
 import org.apache.maven.artifact.Artifact;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/17063b89/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
----------------------------------------------------------------------
diff --git 
a/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
 
b/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
index b8e883f..dd0e81a 100644
--- 
a/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
+++ 
b/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
@@ -360,8 +360,6 @@ public class DbImporterMojoTest extends 
AbstractMojoTestCase {
     }
 
     private void test(String name) throws Exception {
-//        MavenProject mavenProject = 
getMavenProject("src/test/resources/org/apache/cayenne/tools/dbimport/" + name 
+ "-pom.xml");
-
         DbImporterMojo cdbImport = getCdbImport("dbimport/" + name + 
"-pom.xml");
         File mapFile = cdbImport.getMap();
         File mapFileCopy = new File(mapFile.getParentFile(), "copy-" + 
mapFile.getName());

Reply via email to