Uploaded image for project: 'Sakai Maven Plugin'
  1. Sakai Maven Plugin
  2. SMP-16

Maven3 parallel execution support in Sakai Maven Plugin



    • Type: (Deprecated) Contributed Patch
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4.2
    • Labels:
    • Previous Issue Keys:


      Maven3 supports parallel builds which can dramatically increase build times. Maven analyses the projects and executes the plugins accordingly. Almost all CPU's are multicored these days and we can take advantage of that to save time on builds.

      For example the following command will spawn 4 threads to build:

      mvn clean install -T 4

      And the following will spawn two threads per cpu core:

      mvn clean install -T 2C

      Currently you get the following:

      [WARNING] *****************************************************************
      [WARNING] * Your build is requesting parallel execution, but project *
      [WARNING] * contains the following plugin(s) that are not marked as *
      [WARNING] * @threadSafe to support parallel building. *
      [WARNING] * While this /may/ work fine, please look for plugin updates *
      [WARNING] * and/or request plugins be made thread-safe. *
      [WARNING] * If reporting an issue, report it against the plugin in *
      [WARNING] * question, not against maven-core *
      [WARNING] *****************************************************************
      [WARNING] The following plugins are not marked @threadSafe in project_name:
      [WARNING] org.sakaiproject.maven.plugins:sakai:1.2.0
      [WARNING] *****************************************************************


      Mojo thread safety assertion checklist
      Sometimes it can be hard to determine if a plugin and the underlying libraries are thread-safe, so when adding @threadSafe the following checklist can be used:

      • Check all static fields/variables in plugin/plugin code are not subject to threading problems.
      • You might want to pay special attention to static member variables of the subclasses of "java.text.Format" (NumeberFormat, DateFormat etc), most of which
        are not threadsafe and cannot be shared as static variables.
      • Check any plexus components.xml; if the components defined are singletons they need to be threadsafe.
      • Check for presence of known tainted libraries.
      • Check thread safety of any other third party libraries. This last item can be a bit hard, but inquiries on mailing lists can get you a long way.

      This checklist qualifies for a "simple thread safety" review of a mojo.

      If a mojo uses a known-non-threadsafe external dependency, you may want to do something like this:

      public class MyMojo
      extends AbstractMojo

      private static final Object lock = new Object();

      public void execute()
      synchronized( lock)

      { // Main mojo code }


        Gliffy Diagrams



              Issue Links



                  arwhyte Anthony Whyte
                  steve.swinsburg Steve Swinsburg
                  0 Vote for this issue
                  7 Start watching this issue