openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1765684 - in /openwebbeans/microwave/trunk/microwave-gradle-plugin: pom.xml src/main/java/org/apache/microwave/gradle/MicrowavePlugin.java src/main/java/org/apache/microwave/gradle/MicrowaveTask.java src/test/
Date Wed, 19 Oct 2016 17:04:16 GMT
Author: rmannibucau
Date: Wed Oct 19 17:04:16 2016
New Revision: 1765684

URL: http://svn.apache.org/viewvc?rev=1765684&view=rev
Log:
making gradle plugin working

Removed:
    openwebbeans/microwave/trunk/microwave-gradle-plugin/src/test/
Modified:
    openwebbeans/microwave/trunk/microwave-gradle-plugin/pom.xml
    openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowavePlugin.java
    openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java

Modified: openwebbeans/microwave/trunk/microwave-gradle-plugin/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-gradle-plugin/pom.xml?rev=1765684&r1=1765683&r2=1765684&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-gradle-plugin/pom.xml (original)
+++ openwebbeans/microwave/trunk/microwave-gradle-plugin/pom.xml Wed Oct 19 17:04:16 2016
@@ -32,11 +32,15 @@
   <artifactId>microwave-gradle-plugin</artifactId>
   <name>Microwave :: Gradle</name>
 
+  <properties>
+    <gradle.version>3.1</gradle.version>
+  </properties>
+
   <dependencies>
     <dependency>
       <groupId>org.gradle</groupId>
       <artifactId>gradle-core</artifactId>
-      <version>3.0</version>
+      <version>${gradle.version}</version>
       <scope>provided</scope>
     </dependency>
     <dependency>
@@ -45,7 +49,6 @@
       <version>2.4.3</version>
       <scope>provided</scope>
     </dependency>
-
     <!-- you surely don't want to do that, check the code ;) -->
   </dependencies>
 

Modified: openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowavePlugin.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowavePlugin.java?rev=1765684&r1=1765683&r2=1765684&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowavePlugin.java
(original)
+++ openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowavePlugin.java
Wed Oct 19 17:04:16 2016
@@ -44,11 +44,12 @@ public class MicrowavePlugin implements
             actionProject.getRepositories().mavenCentral();
         });
 
-        final Configuration configuration = project.getConfigurations().getByName(NAME);
+        final Configuration configuration = project.getConfigurations().maybeCreate(NAME);
         configuration.getIncoming().beforeResolve(resolvableDependencies -> {
             String version;
             try {
-                try (final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/maven/org.apache.microwave/microwave-core/pom.properties"))
{
+                final String resource = "META-INF/maven/org.apache.microwave/microwave-gradle-plugin/pom.properties";
+                try (final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource))
{
                     final Properties p = new Properties();
                     p.load(is);
                     version = p.getProperty("version");
@@ -59,7 +60,7 @@ public class MicrowavePlugin implements
 
             final DependencyHandler dependencyHandler = project.getDependencies();
             final DependencySet dependencies = configuration.getDependencies();
-            dependencies.add(dependencyHandler.create("org.apache.microwave:microwave:" +
version));
+            dependencies.add(dependencyHandler.create("org.apache.microwave:microwave-core:"
+ version));
         });
 
         project.task(new HashMap<String, Object>() {{

Modified: openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java?rev=1765684&r1=1765683&r2=1765684&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
(original)
+++ openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
Wed Oct 19 17:04:16 2016
@@ -252,9 +252,9 @@ public class MicrowaveTask extends Defau
             containerClass.getMethod("start").invoke(container);
             final String fixedContext = ofNullable(context).orElse("");
             if (webapp == null) {
-                configClass.getMethod("deployClasspath", String.class).invoke(container,
fixedContext);
+                containerClass.getMethod("deployClasspath", String.class).invoke(container,
fixedContext);
             } else {
-                configClass.getMethod("deployWebapp", String.class, File.class).invoke(container,
fixedContext, webapp);
+                containerClass.getMethod("deployWebapp", String.class, File.class).invoke(container,
fixedContext, webapp);
             }
 
             getLogger().info("Microwave started on " + configClass.getMethod("getHost").invoke(config)
+ ":" + configClass.getMethod("getHttpPort").invoke(config));
@@ -297,7 +297,7 @@ public class MicrowaveTask extends Defau
 
     private Object getConfig(final Class<?> configClass) throws Exception {
         final Object config = configClass.newInstance();
-        for (final Field field : MicrowaveExtension.class.getDeclaredFields()) {
+        for (final Field field : MicrowaveTask.class.getDeclaredFields()) {
             try {
                 final Field configField = configClass.getDeclaredField(field.getName());
                 if (!configField.getType().equals(field.getType())) {
@@ -319,7 +319,7 @@ public class MicrowaveTask extends Defau
             } catch (final NoSuchFieldException nsfe) {
                 // ignored
             } catch (final Exception e) {
-                getLogger().warn("can't initialize attribute " + field.getName());
+                getLogger().warn("can't initialize attribute " + field.getName(), e);
             }
         }
 
@@ -412,7 +412,7 @@ public class MicrowaveTask extends Defau
 
         // defaults
         if (classpath == null) {
-            classpath.add(project.getConfigurations().getByName(MicrowavePlugin.NAME).fileCollection());
+            classpath = project.getConfigurations().getByName(MicrowavePlugin.NAME);
         }
 
         if (dir == null) {
@@ -437,7 +437,7 @@ public class MicrowaveTask extends Defau
                             f.set(this, val);
                         }
                     } catch (final IllegalAccessException | NoSuchFieldException e) {
-                        getLogger().warn("No field " + f.getName() + " in " + extension,
e);
+                        getLogger().debug("No field " + f.getName() + " in " + extension,
e);
                     }
                 }
             }



Mime
View raw message