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 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.
    • resolveSourceDirectories

      Resolves the source directories by checking the existence of Java, Groovy or Kotlin sources.
      Returns:
      a map with the language as key and the source directory as value.
    • findRunnableProject

      public org.apache.maven.project.MavenProject findRunnableProject()
      Finds the Maven project that has the Micronaut Maven plugin defined.
      Returns:
      the Maven project
    • resolveDependencies

      public List<org.eclipse.aether.graph.Dependency> resolveDependencies(String... scopes)
      Resolves project dependencies for the given scopes.
      Parameters:
      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