Class CompilerService

java.lang.Object
io.micronaut.maven.services.CompilerService

@Singleton public class CompilerService extends Object
Provides methods to compile a Maven project.
Since:
1.1
Author:
Álvaro Sánchez-Mariscal
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    CompilerService(org.apache.maven.execution.MavenSession mavenSession, ExecutorService executorService, org.apache.maven.project.ProjectDependenciesResolver resolver)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    buildClasspath(List<org.eclipse.aether.graph.Dependency> dependencies)
    Builds a classpath string for the given dependencies.
    Compiles the project.
    org.apache.maven.shared.invoker.InvocationResult
    Packages the project by invoking the Jar plugin.
    List<org.eclipse.aether.graph.Dependency>
    resolveDependencies(org.apache.maven.project.MavenProject runnableProject, boolean excludeProjects, String... scopes)
    Resolves project dependencies for the given scopes.
    List<org.eclipse.aether.graph.Dependency>
    resolveDependencies(org.apache.maven.project.MavenProject runnableProject, String... scopes)
    Resolves project dependencies for given scopes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • CompilerService

      @Inject public CompilerService(org.apache.maven.execution.MavenSession mavenSession, ExecutorService executorService, org.apache.maven.project.ProjectDependenciesResolver resolver)
  • Method Details

    • compileProject

      Compiles the project.
      Returns:
      the last compilation time millis.
    • resolveDependencies

      public List<org.eclipse.aether.graph.Dependency> resolveDependencies(org.apache.maven.project.MavenProject runnableProject, String... scopes)
      Resolves project dependencies for given scopes.
      Parameters:
      runnableProject - The project
      scopes - The scopes
      Returns:
      The dependencies
    • resolveDependencies

      public List<org.eclipse.aether.graph.Dependency> resolveDependencies(org.apache.maven.project.MavenProject runnableProject, boolean excludeProjects, String... scopes)
      Resolves project dependencies for the given scopes.
      Parameters:
      runnableProject - the project to resolve dependencies for.
      excludeProjects - Whether to exclude projects (of this build) from the dependencies.
      scopes - the scopes to resolve dependencies for.
      Returns:
      the list of dependencies.
    • buildClasspath

      public String buildClasspath(List<org.eclipse.aether.graph.Dependency> dependencies)
      Builds a classpath string for the given dependencies.
      Parameters:
      dependencies - the dependencies to build the classpath for.
      Returns:
      the classpath string.
    • packageProject

      public org.apache.maven.shared.invoker.InvocationResult packageProject() throws org.apache.maven.shared.invoker.MavenInvocationException
      Packages the project by invoking the Jar plugin.
      Returns:
      the invocation result.
      Throws:
      org.apache.maven.shared.invoker.MavenInvocationException