Class MjResolve

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.eolang.maven.MjResolve
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="resolve", defaultPhase=PROCESS_SOURCES, threadSafe=true) public final class MjResolve extends org.apache.maven.plugin.AbstractMojo
Find all required runtime dependencies, download them from Maven Central, unpack and place to the target/eo directory.

The motivation for this mojo is simple: Maven doesn't have a mechanism for adding .JAR files to transpile/test classpath in runtime.

Since:
0.1
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected File
    EO cache directory.
    protected boolean
    Use global caching or not.
    protected BiConsumer<org.apache.maven.model.Dependency,Path>
    The central.
    protected File
    Directory where classes are stored in target.
    protected boolean
    Shall we discover JAR artifacts for .EO sources?
    protected boolean
    Whether we should fail on warning.
    protected File
    File with foreign "tojos".
    protected String
    Format of "foreign" file ("json" or "csv").
    protected File
    Generated sourced directory.
    protected org.eolang.maven.CommitHash
    The Git hash to pull objects from.
    protected boolean
    Add eo-runtime dependency to the classpath.
    protected boolean
    Fail resolution process on transitive dependencies.
    protected boolean
    Fail resolution process on conflicting dependencies.
    protected Set<String>
    List of inclusion GLOB filters for unplacing and unspiling (ONLY these files will stay).
    protected boolean
    Whether we should lint all the sources together as package.
    protected org.apache.maven.plugin.BuildPluginManager
    Maven plugin manager.
    protected boolean
    If we are offline and not able to download anything from the internet.
    protected boolean
    Pull again even if the .eo file is already present?
    protected Set<String>
    List of inclusion GLOB filters for finding class files while placing them from where they were resolved to classes directory.
    protected File
    The path to a text file where paths of all added .class (and maybe others) files are placed.
    protected String
    Format of "placed" file ("json" or "csv").
    protected final org.eolang.maven.TjsPlaced
    Placed tojos.
    protected org.apache.maven.plugin.descriptor.PluginDescriptor
    The current version of eo-maven-plugin.
    protected org.apache.maven.project.MavenProject
    Maven project.
    protected boolean
    Rewrite binaries in output directory or not.
    protected String
    Current scope (either "compile" or "test").
    protected org.apache.maven.execution.MavenSession
    Maven session.
    protected Set<String>
    List of exclusion GLOB filters for finding class files while placing them from where they were resolved to classed directory.
    protected boolean
    If set to TRUE, experimental lints are skipped during the linting.
    protected boolean
    Whether we should skip linting at all.
    protected Set<String>
    List of WPA lints which must be skipped during the linting.
    protected Set<String>
    List of individual lints which must be skipped during the linting.
    protected boolean
    Skip artifact with the version 0.0.0.
    protected File
    Directory in which .eo files are located.
    protected String
    The Git tag to pull objects from, in objectionary.
    protected File
    Target directory.
    protected Integer
    Mojo execution timeout in seconds.
    protected boolean
    Track optimization steps into intermediate XMIR files?
    protected boolean
    If set to TRUE, the exception on exit will be printed in details to the log.
    protected File
    The path of the file where XSL measurements (time of execution in milliseconds) will be stored.

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final org.eolang.maven.TjsForeign
    Tojos to use, in "compile" scope only.
    void
     
    final void
    Execute it.
    static boolean
    isRuntime(org.apache.maven.model.Dependency dep)
    Checks if dependency is runtime.
    protected final com.yegor256.xsline.Train<com.yegor256.xsline.Shift>
    measured(com.yegor256.xsline.Train<com.yegor256.xsline.Shift> train)
    Make a measured train from another train.
    protected final org.eolang.maven.TjsForeign
    Tojos to use, in my scope only.
     

    Methods inherited from class org.apache.maven.plugin.AbstractMojo

    getLog, getPluginContext, setLog, setPluginContext

    Methods inherited from class java.lang.Object

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

    • project

      @Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject project
      Maven project.
    • session

      @Parameter(defaultValue="${session}", readonly=true) protected org.apache.maven.execution.MavenSession session
      Maven session.
    • manager

      @Component protected org.apache.maven.plugin.BuildPluginManager manager
      Maven plugin manager.
    • classesDir

      @Parameter(defaultValue="${project.build.directory}/classes", readonly=true, required=true) protected File classesDir
      Directory where classes are stored in target.
    • foreign

      @Parameter(property="eo.foreign", required=true, defaultValue="${project.build.directory}/eo-foreign.json") protected File foreign
      File with foreign "tojos".
    • foreignFormat

      @Parameter(property="eo.foreignFormat", required=true, defaultValue="csv") protected String foreignFormat
      Format of "foreign" file ("json" or "csv").
    • sourcesDir

      @Parameter(property="eo.sourcesDir", required=true, defaultValue="${project.basedir}/src/main/eo") protected File sourcesDir
      Directory in which .eo files are located.
    • targetDir

      @Parameter(property="eo.targetDir", required=true, defaultValue="${project.build.directory}/eo") protected File targetDir
      Target directory.
    • scope

      @Parameter(property="eo.scope") protected String scope
      Current scope (either "compile" or "test").
    • placed

      @Parameter(property="eo.placed", required=true, defaultValue="${project.build.directory}/eo-placed.json") protected File placed
      The path to a text file where paths of all added .class (and maybe others) files are placed.
      Since:
      0.11.0
    • placedFormat

      @Parameter(property="eo.placedFormat", required=true, defaultValue="json") protected String placedFormat
      Format of "placed" file ("json" or "csv").
    • generatedDir

      @Parameter(property="eo.generatedDir", required=true, defaultValue="${project.build.directory}/generated-sources") protected File generatedDir
      Generated sourced directory.
    • xslMeasures

      @Parameter(property="eo.xslMeasuresFile", required=true, defaultValue="${project.build.directory}/eo/xsl-measures.json") protected File xslMeasures
      The path of the file where XSL measurements (time of execution in milliseconds) will be stored.
      Since:
      0.41.0
    • timeout

      @Parameter(property="eo.timeout") protected Integer timeout
      Mojo execution timeout in seconds.
      Since:
      0.28.12
    • trackTransformationSteps

      @Parameter(property="eo.trackTransformationSteps", required=true, defaultValue="false") protected boolean trackTransformationSteps
      Track optimization steps into intermediate XMIR files?
      Since:
      0.24.0
    • unrollExitError

      @Parameter(property="eo.unrollExitError") protected boolean unrollExitError
      If set to TRUE, the exception on exit will be printed in details to the log.
      Since:
      0.29.0
    • cache

      @Parameter(property="eo.cache") protected File cache
      EO cache directory.
    • cacheEnabled

      @Parameter(property="eo.cacheEnabled", defaultValue="true") protected boolean cacheEnabled
      Use global caching or not.
      Since:
      0.55.0
    • rewriteBinaries

      @Parameter(property="eo.rewriteBinaries", defaultValue="true") protected boolean rewriteBinaries
      Rewrite binaries in output directory or not.
      Since:
      0.32.0
    • offline

      @Parameter(property="eo.offline", required=true, defaultValue="false") protected boolean offline
      If we are offline and not able to download anything from the internet.
      Since:
      0.32.0
    • tag

      @Parameter(property="eo.tag", required=true, defaultValue="master") protected String tag
      The Git tag to pull objects from, in objectionary.
      Since:
      0.21.0
    • skipExperimentalLints

      @Parameter(property="eo.skipExperimentalLints", required=true, defaultValue="false") protected boolean skipExperimentalLints
      If set to TRUE, experimental lints are skipped during the linting.
      Since:
      0.57.0
    • overWrite

      @Parameter(property="eo.overWrite", required=true, defaultValue="false") protected boolean overWrite
      Pull again even if the .eo file is already present?
      Since:
      0.10.0
    • skipZeroVersions

      @Parameter(property="eo.skipZeroVersions", required=true, defaultValue="true") protected boolean skipZeroVersions
      Skip artifact with the version 0.0.0.
      Since:
      0.9.0
    • ignoreVersionConflicts

      @Parameter(property="eo.ignoreVersionConflicts", required=true, defaultValue="false") protected boolean ignoreVersionConflicts
      Fail resolution process on conflicting dependencies.
      Since:
      0.1.0
    • discoverSelf

      @Parameter(property="eo.discoverSelf", required=true, defaultValue="false") protected boolean discoverSelf
      Shall we discover JAR artifacts for .EO sources?
      Since:
      0.12.0
    • placeBinaries

      @Parameter protected Set<String> placeBinaries
      List of inclusion GLOB filters for finding class files while placing them from where they were resolved to classes directory.
      Since:
      0.15
    • skipSourceLints

      @Parameter protected Set<String> skipSourceLints
      List of individual lints which must be skipped during the linting.
      Since:
      0.57
    • skipProgramLints

      @Parameter protected Set<String> skipProgramLints
      List of WPA lints which must be skipped during the linting.
      Since:
      0.57
    • skipBinaries

      @Parameter protected Set<String> skipBinaries
      List of exclusion GLOB filters for finding class files while placing them from where they were resolved to classed directory.
      Since:
      0.15
    • keepBinaries

      @Parameter protected Set<String> keepBinaries
      List of inclusion GLOB filters for unplacing and unspiling (ONLY these files will stay).
      Since:
      0.24
      See Also:
    • ignoreRuntime

      @Parameter(property="eo.ignoreRuntime", required=true, defaultValue="false") protected boolean ignoreRuntime
      Add eo-runtime dependency to the classpath.

      That property is useful only for eo-runtime library compilation. When you compile eo-runtime, you don't want to add eo-runtime from foreign sources (since you compile an eo-runtime library and classpath will anyway have all required classes) and in this case, you should set this property to true. In any other cases, the eo-runtime dependency will be downloaded and added to the classpath automatically.

    • ignoreTransitive

      @Parameter(property="eo.ignoreTransitive", required=true, defaultValue="false") protected boolean ignoreTransitive
      Fail resolution process on transitive dependencies.
    • failOnWarning

      @Parameter(property="eo.failOnWarning", required=true, defaultValue="true") protected boolean failOnWarning
      Whether we should fail on warning.
    • lintAsPackage

      @Parameter(property="eo.lintAsPackage", required=true, defaultValue="true") protected boolean lintAsPackage
      Whether we should lint all the sources together as package.
    • skipLinting

      @Parameter(property="eo.skipLinting", required=true, defaultValue="false") protected boolean skipLinting
      Whether we should skip linting at all.
    • plugin

      @Parameter(defaultValue="${plugin}", readonly=true) protected org.apache.maven.plugin.descriptor.PluginDescriptor plugin
      The current version of eo-maven-plugin. Maven 3 only. You can read more about that property here.
    • placedTojos

      protected final org.eolang.maven.TjsPlaced placedTojos
      Placed tojos.
    • central

      protected BiConsumer<org.apache.maven.model.Dependency,Path> central
      The central.
    • hash

      protected org.eolang.maven.CommitHash hash
      The Git hash to pull objects from. If not set, will be computed from tag field.
  • Constructor Details

    • MjResolve

      public MjResolve()
  • Method Details

    • exec

      public void exec() throws IOException
      Throws:
      IOException
    • isRuntime

      public static boolean isRuntime(org.apache.maven.model.Dependency dep)
      Checks if dependency is runtime.
      Parameters:
      dep - Dependency
      Returns:
      True if runtime.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • execute

      public final void execute() throws org.apache.maven.plugin.MojoFailureException
      Execute it.
      Throws:
      org.apache.maven.plugin.MojoFailureException - If fails during build
    • scopedTojos

      protected final org.eolang.maven.TjsForeign scopedTojos()
      Tojos to use, in my scope only.
      Returns:
      Tojos to use
    • compileTojos

      protected final org.eolang.maven.TjsForeign compileTojos()
      Tojos to use, in "compile" scope only.
      Returns:
      Tojos to use
    • measured

      protected final com.yegor256.xsline.Train<com.yegor256.xsline.Shift> measured(com.yegor256.xsline.Train<com.yegor256.xsline.Shift> train)
      Make a measured train from another train.
      Parameters:
      train - The train
      Returns:
      Measured train