Why doesn't Maven 3.3 include "javax.inject", but Maven 3.2 does?

My Maven build doesn't work when using Maven 3.3.1, but works successfully with Maven 3.2.2.

So far I have run /path/to/3.3.1/mvn clean compile -X

and compared the result with the one that was generated /path/to/3.2.2/mvn clean compile -X

.

There maven-compiler-plugin / default-compile

was a difference in the phase in the next block:

[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-compiler-plugin:3.2
[DEBUG]   Included: org.apache.maven.plugins:maven-compiler-plugin:jar:3.2
[DEBUG]   Included: com.google.dagger:dagger-compiler:jar:2.0
[DEBUG]   Included: com.google.dagger:dagger:jar:2.0
[DEBUG]   Included: com.google.dagger:dagger-producers:jar:2.0-beta
[DEBUG]   Included: com.google.guava:guava:jar:18.0
...

      

Difference: While Maven 3.2.2 is printed [DEBUG] Included: javax.inject:javax.inject:jar:1

, it is missing for Maven 3.3.1.

I don't know if this helps, but this is my efficient build plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.2</version> <!-- 3.3 respectively -->
    <dependencies>
        <dependency>
            <groupId>com.google.dagger</groupId>
            <artifactId>dagger-compiler</artifactId>
            <version>2.0</version>
        </dependency>
    </dependencies>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
        <!-- workaround for http://jira.codehaus.org/browse/MCOMPILER-202 -->
        <forceJavacCompilerUse>true</forceJavacCompilerUse>
    </configuration>
</plugin>

      

What I don't understand: what exactly does the "Population class realm" plugin do? Why is the jar missing even though it has been identified as a dependency on both maven versions?

Edit: Build fails with this exception:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project ui: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project ui: Compilation failure
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:913)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 20 more

      

A minimal example project is available on GitHub . The complete output of the crash command is available here .

+3


source to share


1 answer


The problem is not with the version of the maven-compiler-plugin.
When you use the forceJavacCompilerUse option , it will basically use the javax.tool API implementation in your JDK.
Since you are using dagger-compiler which depends on javax.inject , it should be pulled.

You can try adding a [assuming] scope for your plugin dependency using the dagger compiler, this way you will block all transitive dependencies.



Also make sure you add the  dependency dagger in your runtime dependencies.

Please provide more information on the exception-stack trail and other related areas of your estate that will help visitors limit the problem and guide you quickly!

+3


source







All Articles