You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2024/01/10 14:51:05 UTC

(uima-ruta) branch refactoring/157-Mark-Maven-Mojos-as-thread-safe created (now 1852e9b7)

This is an automated email from the ASF dual-hosted git repository.

rec pushed a change to branch refactoring/157-Mark-Maven-Mojos-as-thread-safe
in repository https://gitbox.apache.org/repos/asf/uima-ruta.git


      at 1852e9b7 Issue #157: Mark Maven Mojos as thread-safe

This branch includes the following new commits:

     new 1852e9b7 Issue #157: Mark Maven Mojos as thread-safe

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(uima-ruta) 01/01: Issue #157: Mark Maven Mojos as thread-safe

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch refactoring/157-Mark-Maven-Mojos-as-thread-safe
in repository https://gitbox.apache.org/repos/asf/uima-ruta.git

commit 1852e9b7d712c31f3713740508882f2f35069691
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Wed Jan 10 15:51:00 2024 +0100

    Issue #157: Mark Maven Mojos as thread-safe
    
    - Marked mojos as thread-safe
---
 .../ruta/maven/RutaGenerateDescriptorMojo.java     | 24 +++++++++++-----------
 .../uima/ruta/maven/RutaGenerateMTWLMojo.java      |  2 +-
 .../uima/ruta/maven/RutaGenerateTWLMojo.java       |  2 +-
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateDescriptorMojo.java b/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateDescriptorMojo.java
index 71cf760e..5dfc507f 100644
--- a/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateDescriptorMojo.java
+++ b/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateDescriptorMojo.java
@@ -85,7 +85,7 @@ import org.xml.sax.SAXException;
  * Generate descriptors from UIMA Ruta script files.
  * 
  */
-@Mojo(name = "generate", defaultPhase = GENERATE_RESOURCES, requiresDependencyResolution = TEST, requiresDependencyCollection = TEST)
+@Mojo(name = "generate", defaultPhase = GENERATE_RESOURCES, requiresDependencyResolution = TEST, requiresDependencyCollection = TEST, threadSafe = true)
 public class RutaGenerateDescriptorMojo extends AbstractMojo {
   private static final String RUTA_BUILD_VARS = "RUTA_BUILD_VARS";
 
@@ -448,8 +448,8 @@ public class RutaGenerateDescriptorMojo extends AbstractMojo {
     }
   }
 
-  public static URLClassLoader getClassloader(MavenProject project, Log aLog, String includeScopeThreshold)
-          throws MojoExecutionException {
+  public static URLClassLoader getClassloader(MavenProject project, Log aLog,
+          String includeScopeThreshold) throws MojoExecutionException {
 
     List<URL> urls = new ArrayList<URL>();
 
@@ -493,7 +493,7 @@ public class RutaGenerateDescriptorMojo extends AbstractMojo {
       throw new MojoExecutionException(
               "Unable to resolve dependencies: " + ExceptionUtils.getRootCauseMessage(e), e);
     }
-    
+
     ScopeArtifactFilter filter = new ScopeArtifactFilter(includeScopeThreshold);
     for (Artifact dep : (Set<Artifact>) project.getArtifacts()) {
       try {
@@ -503,15 +503,15 @@ public class RutaGenerateDescriptorMojo extends AbstractMojo {
                   + ")");
           continue;
         }
-        
+
         if (dep.getFile() == null) {
           aLog.debug("Not generating classpath entry for unresolved artifact: " + dep.getGroupId()
-                  + ":" + dep.getArtifactId() + ":" + dep.getVersion()+ " (" + dep.getScope()
+                  + ":" + dep.getArtifactId() + ":" + dep.getVersion() + " (" + dep.getScope()
                   + ")");
           // Unresolved file because it is in the wrong scope (e.g. test?)
           continue;
         }
-                
+
         aLog.debug("Classpath entry: " + dep.getGroupId() + ":" + dep.getArtifactId() + ":"
                 + dep.getVersion() + " -> " + dep.getFile());
         urls.add(dep.getFile().toURI().toURL());
@@ -521,7 +521,7 @@ public class RutaGenerateDescriptorMojo extends AbstractMojo {
                 + ExceptionUtils.getRootCauseMessage(e), e);
       }
     }
-    
+
     return new URLClassLoader(urls.toArray(new URL[] {}),
             RutaGenerateDescriptorMojo.class.getClassLoader());
   }
@@ -560,7 +560,7 @@ public class RutaGenerateDescriptorMojo extends AbstractMojo {
       // Xpp3DomWriter creates empty string with file writer, check before writing to file
       if (!StringUtils.isBlank(string)) {
         try (Writer os = new OutputStreamWriter(new FileOutputStream(projectFile), UTF_8)) {
-            os.write(string);
+          os.write(string);
         } catch (IOException e) {
           handleError("Failed to write .project file", e);
         }
@@ -600,9 +600,9 @@ public class RutaGenerateDescriptorMojo extends AbstractMojo {
     String string = sw.toString();
     // Xpp3DomWriter creates empty string with file writer, check before writing to file
     if (!StringUtils.isBlank(string)) {
-        try (Writer os = new OutputStreamWriter(new FileOutputStream(buildpathFile), UTF_8)) {
-            os.write(string);
-        } catch (IOException e) {
+      try (Writer os = new OutputStreamWriter(new FileOutputStream(buildpathFile), UTF_8)) {
+        os.write(string);
+      } catch (IOException e) {
         handleError("Failed to write .buildpath file", e);
       }
     }
diff --git a/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateMTWLMojo.java b/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateMTWLMojo.java
index 93ebc1f6..35b50247 100644
--- a/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateMTWLMojo.java
+++ b/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateMTWLMojo.java
@@ -42,7 +42,7 @@ import org.sonatype.plexus.build.incremental.BuildContext;
  * Generate descriptors from UIMA Ruta script files.
  * 
  */
-@Mojo(name = "mtwl", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, requiresDependencyResolution = ResolutionScope.COMPILE)
+@Mojo(name = "mtwl", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true)
 public class RutaGenerateMTWLMojo extends AbstractMojo {
 
   @Parameter(defaultValue = "${project}", readonly = true)
diff --git a/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateTWLMojo.java b/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateTWLMojo.java
index b10ab3cd..e055942d 100644
--- a/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateTWLMojo.java
+++ b/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateTWLMojo.java
@@ -44,7 +44,7 @@ import org.sonatype.plexus.build.incremental.BuildContext;
  * Generate descriptors from UIMA Ruta script files.
  * 
  */
-@Mojo(name = "twl", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, requiresDependencyResolution = ResolutionScope.COMPILE)
+@Mojo(name = "twl", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true)
 public class RutaGenerateTWLMojo extends AbstractMojo {
 
   @Parameter(defaultValue = "${project}", readonly = true)