[ https://issues.apache.org/jira/browse/ODFTOOLKIT-464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16147948#comment-16147948 ]
Olivier Cailloux edited comment on ODFTOOLKIT-464 at 8/30/17 8:03 PM: ---------------------------------------------------------------------- This bug report is about org.slf4j:slf4j-log4j12, not slf4j per se (which indeed is a required compile-time dependency, and which does not hurt). SLF4J-Log4j12 is a SLF4J binding, and exactly one SLF4J binding is required at runtime. (The link in the original post explains further.) Your users should be free to use the binding of their choice (this is an important feature of SLF4J and clearly explained in the doc of the SLF4J project). Thus, org.slf4j:slf4j-log4j12 should be marked optional in the relevant pom.xml, meaning that it will not be imposed as a transitive dependency on users of odf toolkit. As tools.jar is not required during run-time (per your previous comment), it should be marked optional as well. The only remaining question is: where should this problem be solved, which requires some decision concerning the infrastructure of the projects. As I tried to explain, solving the problems in the cleanest way would involve correcting things deeper than just at the ODF Toolkit level. But it is also possible to correct things at the level of ODF Toolkit if need be. In any case, I do not see a reason to consider this bug report as invalid. IMHO, a program is responsible for problems stemming from the libraries it uses. In case it is useful, let me explain why this is not just a pedantic issue. In a Java course I taught last year, a group of students that I had told to use ODF Toolkit struggled and lost quite a bit of time because of the tools.jar dependency which was imposed on their projects by ODF Toolkit. They didn’t know they could declare tools.jar as “ignorable” in their own POM (that’s not something you often have to do in simple projects), thus they, quite understandably, tried to comply with the stated instructions and tried to include tools.jar in their own project, which in turn created other issues. Granted, now that I have looked at the problem I know I should warn the next students about this, but 1) your users should not have to use such dirty tricks to use the library; and 2) other users, even not students but not very knowledgeable in Maven, could have the same problem (and would probably give up using ODF Toolkit if they are not obliged by their teacher to try harder). was (Author: oliviercailloux): This bug report is about org.slf4j:slf4j-log4j12, not slf4j per se (which indeed is a required compile-time dependency, and which does not hurt). SLF4J-Log4j12 is a SLF4J binding, and exactly one SLF4J binding is required at runtime. (The link in the original post explains further.) Your users should be free to use the binding of their choice (this is an important feature of SLF4J and clearly explained in the doc of the SLF4J project). Thus, org.slf4j:slf4j-log4j12 should be marked optional in the relevant pom.xml, meaning that it will not be imposed as a transitive dependency on users of odf toolkit. As tools.jar is not required during run-time (per your previous comment), it should be marked optional as well. The only remaining question is: where should this problem be solved, which requires some decision concerning the infrastructure of the projects. As I tried to explain, solving the problems in the cleanest way would involve correcting things deeper than just at the ODF Toolkit level. But it is also possible to correct things at the level of ODF Toolkit if need be. In any case, I do not see a reason to consider this bug report as invalid. IMHO, a program is responsible for problems stemming from the libraries it uses. In case it is useful, let me explain why this is not just a pedantic issue. In a Java course I taught last year, a group of students that I had told to use ODF Toolkit struggled and lost quite a bit of time because of the tools.jar dependency which was imposed on their projects by ODF Toolkit. They didn’t know they could declare tools.jar as “ignorable” in their own POM (that’s not something you often have to do in simple projects), thus they, quite understandable, tried to comply with the stated instructions and tried to include tools.jar in their own project, which in turn created other issues. Granted, now that I have looked at the problem I know I should warn the next students about this, but 1) your users should not have to use such dirty tricks to use the library; and 2) other users, even not students but not very knowledgeable in Maven, could have the same problem (and would probably give up using ODF Toolkit if they are not obliged by their teacher to try harder). > Pom does not follow best practices: missing optional keyword > ------------------------------------------------------------ > > Key: ODFTOOLKIT-464 > URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-464 > Project: ODF Toolkit > Issue Type: Bug > Components: simple api > Reporter: Olivier Cailloux > Priority: Minor > > When depending on Apache ODFToolkit simple-odf in my application > (org.apache.odftoolkit:simple-odf:0.8.2-incubating), I observe that > com.sun:tools is transitively imposed on my project as a dependency (coming > from taglets, see its > [POM|https://repo1.maven.org/maven2/org/apache/odftoolkit/taglets/0.8.11-incubating/taglets-0.8.11-incubating.pom]). > Similarly, org.slf4j:slf4j-log4j12 is passed to my project as a dependency. > I suspect these dependencies are actually not required for projects depending > on simple-odf. > It is possible and simple to ease the life of users of simple-odf by adding > <optional> in the relevant pom files. This would respect Maven best > practices. (See for example > [SO|https://stackoverflow.com/questions/32231814/how-can-i-remove-logback-from-a-librarys-dependency-while-keeping-slf4j].) > Workaround: add exclusion rules for these artifacts (see this example > [POM|https://github.com/oliviercailloux/Test-ODFToolkit-ODS/blob/master/pom.xml]). > (I tried to discuss it > [here|https://lists.apache.org/thread.html/6fa4257e67ede90bac58f5518e1be41e7561a451149cbc9eecdbbf1e@%3Codf-users.incubator.apache.org%3E] > but received no answer.) -- This message was sent by Atlassian JIRA (v6.4.14#64029)