Compilation failure: module not found: org.apache.logging.log4j










3















I have simple application written in Java 11. mvn clean verify (maven 3.6.0) executes with error:



[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project parser: Compilation failure
[ERROR] ...src/main/java/module-info.java:[2,32] module not found: org.apache.logging.log4j


Dependencies:



<log4j.version>2.11.1</log4j.version>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>$log4j.version</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>$log4j.version</version>
</dependency>


Module-info.java:



module abc 
requires org.apache.logging.log4j;



Log4j2 configuration is default and in .xml file. Usage:



import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

private static final Logger logger = LogManager.getLogger(Abc.class);

logger.info("Boom!");


I tried all related questions on stackoverflow with no success.










share|improve this question



















  • 3





    Could you try and upgrade your maven-compiler-plugin and specify the release as 11? Since describing the log4j-api jar using --release 11 states the same name as in your directive. The reason primarily being that log4j-api is a modular jar. Do note, on the other hand log4j-core is derived as an automatic module.

    – nullpointer
    Nov 15 '18 at 19:54












  • Thank you! It helped. Do you want to write an answer? Better to use referenced answer from your link. in my case I just needed to upgrade version of maven compiler plugin to 3.8.0. I had java version as 11.

    – uli
    Nov 15 '18 at 20:02






  • 2





    Made an answer since there seems to be a slight impact of using the release flag specifically for log4j-api, that being a modular jar. Also, maybe some contributor from the library themselves pitch in with further details over modularisation and plans ahead in consuming the library.

    – nullpointer
    Nov 15 '18 at 20:14















3















I have simple application written in Java 11. mvn clean verify (maven 3.6.0) executes with error:



[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project parser: Compilation failure
[ERROR] ...src/main/java/module-info.java:[2,32] module not found: org.apache.logging.log4j


Dependencies:



<log4j.version>2.11.1</log4j.version>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>$log4j.version</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>$log4j.version</version>
</dependency>


Module-info.java:



module abc 
requires org.apache.logging.log4j;



Log4j2 configuration is default and in .xml file. Usage:



import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

private static final Logger logger = LogManager.getLogger(Abc.class);

logger.info("Boom!");


I tried all related questions on stackoverflow with no success.










share|improve this question



















  • 3





    Could you try and upgrade your maven-compiler-plugin and specify the release as 11? Since describing the log4j-api jar using --release 11 states the same name as in your directive. The reason primarily being that log4j-api is a modular jar. Do note, on the other hand log4j-core is derived as an automatic module.

    – nullpointer
    Nov 15 '18 at 19:54












  • Thank you! It helped. Do you want to write an answer? Better to use referenced answer from your link. in my case I just needed to upgrade version of maven compiler plugin to 3.8.0. I had java version as 11.

    – uli
    Nov 15 '18 at 20:02






  • 2





    Made an answer since there seems to be a slight impact of using the release flag specifically for log4j-api, that being a modular jar. Also, maybe some contributor from the library themselves pitch in with further details over modularisation and plans ahead in consuming the library.

    – nullpointer
    Nov 15 '18 at 20:14













3












3








3


1






I have simple application written in Java 11. mvn clean verify (maven 3.6.0) executes with error:



[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project parser: Compilation failure
[ERROR] ...src/main/java/module-info.java:[2,32] module not found: org.apache.logging.log4j


Dependencies:



<log4j.version>2.11.1</log4j.version>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>$log4j.version</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>$log4j.version</version>
</dependency>


Module-info.java:



module abc 
requires org.apache.logging.log4j;



Log4j2 configuration is default and in .xml file. Usage:



import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

private static final Logger logger = LogManager.getLogger(Abc.class);

logger.info("Boom!");


I tried all related questions on stackoverflow with no success.










share|improve this question
















I have simple application written in Java 11. mvn clean verify (maven 3.6.0) executes with error:



[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project parser: Compilation failure
[ERROR] ...src/main/java/module-info.java:[2,32] module not found: org.apache.logging.log4j


Dependencies:



<log4j.version>2.11.1</log4j.version>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>$log4j.version</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>$log4j.version</version>
</dependency>


Module-info.java:



module abc 
requires org.apache.logging.log4j;



Log4j2 configuration is default and in .xml file. Usage:



import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

private static final Logger logger = LogManager.getLogger(Abc.class);

logger.info("Boom!");


I tried all related questions on stackoverflow with no success.







java maven log4j2 java-module java-11






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 20:14









nullpointer

43.8k10102201




43.8k10102201










asked Nov 15 '18 at 19:31









uliuli

519313




519313







  • 3





    Could you try and upgrade your maven-compiler-plugin and specify the release as 11? Since describing the log4j-api jar using --release 11 states the same name as in your directive. The reason primarily being that log4j-api is a modular jar. Do note, on the other hand log4j-core is derived as an automatic module.

    – nullpointer
    Nov 15 '18 at 19:54












  • Thank you! It helped. Do you want to write an answer? Better to use referenced answer from your link. in my case I just needed to upgrade version of maven compiler plugin to 3.8.0. I had java version as 11.

    – uli
    Nov 15 '18 at 20:02






  • 2





    Made an answer since there seems to be a slight impact of using the release flag specifically for log4j-api, that being a modular jar. Also, maybe some contributor from the library themselves pitch in with further details over modularisation and plans ahead in consuming the library.

    – nullpointer
    Nov 15 '18 at 20:14












  • 3





    Could you try and upgrade your maven-compiler-plugin and specify the release as 11? Since describing the log4j-api jar using --release 11 states the same name as in your directive. The reason primarily being that log4j-api is a modular jar. Do note, on the other hand log4j-core is derived as an automatic module.

    – nullpointer
    Nov 15 '18 at 19:54












  • Thank you! It helped. Do you want to write an answer? Better to use referenced answer from your link. in my case I just needed to upgrade version of maven compiler plugin to 3.8.0. I had java version as 11.

    – uli
    Nov 15 '18 at 20:02






  • 2





    Made an answer since there seems to be a slight impact of using the release flag specifically for log4j-api, that being a modular jar. Also, maybe some contributor from the library themselves pitch in with further details over modularisation and plans ahead in consuming the library.

    – nullpointer
    Nov 15 '18 at 20:14







3




3





Could you try and upgrade your maven-compiler-plugin and specify the release as 11? Since describing the log4j-api jar using --release 11 states the same name as in your directive. The reason primarily being that log4j-api is a modular jar. Do note, on the other hand log4j-core is derived as an automatic module.

– nullpointer
Nov 15 '18 at 19:54






Could you try and upgrade your maven-compiler-plugin and specify the release as 11? Since describing the log4j-api jar using --release 11 states the same name as in your directive. The reason primarily being that log4j-api is a modular jar. Do note, on the other hand log4j-core is derived as an automatic module.

– nullpointer
Nov 15 '18 at 19:54














Thank you! It helped. Do you want to write an answer? Better to use referenced answer from your link. in my case I just needed to upgrade version of maven compiler plugin to 3.8.0. I had java version as 11.

– uli
Nov 15 '18 at 20:02





Thank you! It helped. Do you want to write an answer? Better to use referenced answer from your link. in my case I just needed to upgrade version of maven compiler plugin to 3.8.0. I had java version as 11.

– uli
Nov 15 '18 at 20:02




2




2





Made an answer since there seems to be a slight impact of using the release flag specifically for log4j-api, that being a modular jar. Also, maybe some contributor from the library themselves pitch in with further details over modularisation and plans ahead in consuming the library.

– nullpointer
Nov 15 '18 at 20:14





Made an answer since there seems to be a slight impact of using the release flag specifically for log4j-api, that being a modular jar. Also, maybe some contributor from the library themselves pitch in with further details over modularisation and plans ahead in consuming the library.

– nullpointer
Nov 15 '18 at 20:14












1 Answer
1






active

oldest

votes


















2














You shall upgrade to the maven-compiler-plugin:3.8.0 and specify the release as 11.



Reason being, on describing the log4j-api.jar using --release 11 states the same name as in your directive.



jar --file=.../.m2/repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar --describe-module --release 11
releases: 9

org.apache.logging.log4j jar:file://.../.m2/repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar/!META-INF/versions/9/module-info.class
exports org.apache.logging.log4j
exports org.apache.logging.log4j.message
exports org.apache.logging.log4j.simple
exports org.apache.logging.log4j.spi
exports org.apache.logging.log4j.status
exports org.apache.logging.log4j.util
requires java.base mandated
uses org.apache.logging.log4j.message.ThreadDumpMessage$ThreadInfoFactory
uses org.apache.logging.log4j.spi.Provider
uses org.apache.logging.log4j.util.PropertySource


which is primarily because the log4j-api is a modular jar.



On the other hand, log4j-core is derived as an automatic module still which is overridden in its MANIFEST.MF as



org.apache.logging.log4j.core





share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53326716%2fcompilation-failure-module-not-found-org-apache-logging-log4j%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    You shall upgrade to the maven-compiler-plugin:3.8.0 and specify the release as 11.



    Reason being, on describing the log4j-api.jar using --release 11 states the same name as in your directive.



    jar --file=.../.m2/repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar --describe-module --release 11
    releases: 9

    org.apache.logging.log4j jar:file://.../.m2/repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar/!META-INF/versions/9/module-info.class
    exports org.apache.logging.log4j
    exports org.apache.logging.log4j.message
    exports org.apache.logging.log4j.simple
    exports org.apache.logging.log4j.spi
    exports org.apache.logging.log4j.status
    exports org.apache.logging.log4j.util
    requires java.base mandated
    uses org.apache.logging.log4j.message.ThreadDumpMessage$ThreadInfoFactory
    uses org.apache.logging.log4j.spi.Provider
    uses org.apache.logging.log4j.util.PropertySource


    which is primarily because the log4j-api is a modular jar.



    On the other hand, log4j-core is derived as an automatic module still which is overridden in its MANIFEST.MF as



    org.apache.logging.log4j.core





    share|improve this answer



























      2














      You shall upgrade to the maven-compiler-plugin:3.8.0 and specify the release as 11.



      Reason being, on describing the log4j-api.jar using --release 11 states the same name as in your directive.



      jar --file=.../.m2/repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar --describe-module --release 11
      releases: 9

      org.apache.logging.log4j jar:file://.../.m2/repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar/!META-INF/versions/9/module-info.class
      exports org.apache.logging.log4j
      exports org.apache.logging.log4j.message
      exports org.apache.logging.log4j.simple
      exports org.apache.logging.log4j.spi
      exports org.apache.logging.log4j.status
      exports org.apache.logging.log4j.util
      requires java.base mandated
      uses org.apache.logging.log4j.message.ThreadDumpMessage$ThreadInfoFactory
      uses org.apache.logging.log4j.spi.Provider
      uses org.apache.logging.log4j.util.PropertySource


      which is primarily because the log4j-api is a modular jar.



      On the other hand, log4j-core is derived as an automatic module still which is overridden in its MANIFEST.MF as



      org.apache.logging.log4j.core





      share|improve this answer

























        2












        2








        2







        You shall upgrade to the maven-compiler-plugin:3.8.0 and specify the release as 11.



        Reason being, on describing the log4j-api.jar using --release 11 states the same name as in your directive.



        jar --file=.../.m2/repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar --describe-module --release 11
        releases: 9

        org.apache.logging.log4j jar:file://.../.m2/repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar/!META-INF/versions/9/module-info.class
        exports org.apache.logging.log4j
        exports org.apache.logging.log4j.message
        exports org.apache.logging.log4j.simple
        exports org.apache.logging.log4j.spi
        exports org.apache.logging.log4j.status
        exports org.apache.logging.log4j.util
        requires java.base mandated
        uses org.apache.logging.log4j.message.ThreadDumpMessage$ThreadInfoFactory
        uses org.apache.logging.log4j.spi.Provider
        uses org.apache.logging.log4j.util.PropertySource


        which is primarily because the log4j-api is a modular jar.



        On the other hand, log4j-core is derived as an automatic module still which is overridden in its MANIFEST.MF as



        org.apache.logging.log4j.core





        share|improve this answer













        You shall upgrade to the maven-compiler-plugin:3.8.0 and specify the release as 11.



        Reason being, on describing the log4j-api.jar using --release 11 states the same name as in your directive.



        jar --file=.../.m2/repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar --describe-module --release 11
        releases: 9

        org.apache.logging.log4j jar:file://.../.m2/repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar/!META-INF/versions/9/module-info.class
        exports org.apache.logging.log4j
        exports org.apache.logging.log4j.message
        exports org.apache.logging.log4j.simple
        exports org.apache.logging.log4j.spi
        exports org.apache.logging.log4j.status
        exports org.apache.logging.log4j.util
        requires java.base mandated
        uses org.apache.logging.log4j.message.ThreadDumpMessage$ThreadInfoFactory
        uses org.apache.logging.log4j.spi.Provider
        uses org.apache.logging.log4j.util.PropertySource


        which is primarily because the log4j-api is a modular jar.



        On the other hand, log4j-core is derived as an automatic module still which is overridden in its MANIFEST.MF as



        org.apache.logging.log4j.core






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 15 '18 at 20:12









        nullpointernullpointer

        43.8k10102201




        43.8k10102201





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53326716%2fcompilation-failure-module-not-found-org-apache-logging-log4j%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Top Tejano songwriter Luis Silva dead of heart attack at 64

            政党

            天津地下鉄3号線