[ 
https://issues.apache.org/jira/browse/LOG4J2-3215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17471544#comment-17471544
 ] 

ASF subversion and git services commented on LOG4J2-3215:
---------------------------------------------------------

Commit 358a967cf926341eba98e807b614a66e856fbfdc in logging-log4j2's branch 
refs/heads/release-2.x from Volkan Yazici
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=358a967 ]

LOG4J2-3215 Replace usages of "compile" with "implementation" in the Gradle 
docs. (#624)


> Gradle instructions for adding log4j as a dependency are outdated
> -----------------------------------------------------------------
>
>                 Key: LOG4J2-3215
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3215
>             Project: Log4j 2
>          Issue Type: Documentation
>            Reporter: quapka
>            Assignee: Volkan Yazici
>            Priority: Minor
>         Attachments: Dockerfile-1
>
>
> I believe the 
> [instructions|https://logging.apache.org/log4j/2.x/maven-artifacts.html#Using_Log4j_in_your_Gradle_build],
>  are not up-to-date. The "directive" compile has been deprecated in favor of 
> implementation [see 
> here|https://tomgregory.com/gradle-implementation-vs-compile-dependencies/] 
> and [here|https://stackoverflow.com/a/44493379/2377489].
> I've tried setting up a hello-world Java application using Gradle and during 
> gradle build I've got the following error:
> {code:bash}
> ...
> > Could not find method compile() for arguments 
> > [{group=org.apache.logging.log4j, name=log4j-api, version=2.15.0}] on 
> > object of type 
> > org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
> ...
> {code}
> To test this locally I've set up a Dockerfile that showcases using both 
> compile and implementation. Download the attached Dockerfile into a folder 
> and can build the Docker container locally:
> {code:bash}
>  # DOCKER_BUILDKIT=1 is necessary because I use new Docker HEREDOC feature, 
> see comments
>  # in Dockerfile
> $ DOCKER_BUILDKIT=1 docker build --tag log4j-docs .
> {code}
> Once built, run this to see the usage proposed by current docs:
> {code:bash}
> $ docker run -it log4j-docs ./use-compile.sh
> {code}
> Which fails. Then try the new version that succeeds:
> {code:bash}
> $ docker run -it log4j-docs ./use-implementation.sh
> {code}
> See the Dockerfile for details.
> Disclaimer:
> I'm not a Javist and haven't been using Log4j nor Gradle, please, review 
> carefully. This could be a simple docs change, but I don't know if older 
> Gradle versions that could still use compile are still more adapted and 
> therefore this documentation might not work for them. Maybe the docs could 
> specify multiple Gradle build instructions? I am not the one to decide, just 
> laying it out here.
> Also, my first issue on Apache, let me know if there is something I should 
> improve upon.
> Duplicates
> The following 
> [search|https://issues.apache.org/jira/issues/?jql=project%20%3D%20LOG4J2%20AND%20text%20~%20%22gradle%20dependency%20docs%22%20ORDER%20BY%20created%20DESC]
>  yielded 0 hits.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to