[
https://issues.apache.org/jira/browse/ODFTOOLKIT-464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16146143#comment-16146143
]
Olivier Cailloux edited comment on ODFTOOLKIT-464 at 8/29/17 9:19 PM:
----------------------------------------------------------------------
Hi,
I believe I need help from someone who understands the structure of the
projects and the reasons these dependencies have been put there in order to
provide for a clean and durable solution.
Here is the current dependency tree (rooted at simple-odf).
[INFO] +- org.apache.odftoolkit:simple-odf:jar:0.8.2-incubating:compile
[INFO] | +- org.apache.odftoolkit:odfdom-java:jar:0.8.11-incubating:compile
[INFO] | | +- org.apache.odftoolkit:taglets:jar:0.8.11-incubating:compile
[INFO] | | | \- com.sun:tools:jar:1.7.0:system
[INFO] | | +- org.apache.jena:jena-core:jar:2.11.2:compile
[INFO] | | | +- org.apache.jena:jena-iri:jar:1.0.2:compile
[INFO] | | | +- org.slf4j:slf4j-log4j12:jar:1.7.6:compile
[INFO] | | | \- log4j:log4j:jar:1.2.17:compile
[INFO] | | +- net.rootdev:java-rdfa:jar:0.4.2:compile
[INFO] | | \- commons-validator:commons-validator:jar:1.5.0:compile
[INFO] | | +- commons-beanutils:commons-beanutils:jar:1.9.2:compile
[INFO] | | +- commons-digester:commons-digester:jar:1.8.1:compile
[INFO] | | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | | \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] | +- xerces:xercesImpl:jar:2.9.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.3.04:compile
There are several ways to avoid imposing com.sun:tools on users of simple-odf.
Either make the dependency to com.sun:tools optional in
org.apache.odftoolkit:taglets, or make the dependency to taglets optional in
org.apache.odftoolkit:odfdom-java. Also possible: remove the dependency to
com.sun:tools in taglets, or make it appear only in the specific maven plugin
that needs it (if only some maven plugin needs it). The last solution would be
the cleanest one, but it very much depends on what you do with com.sun:tools
and why it is required in taglets, which I do not know.
About the org.slf4j:slf4j-log4j12 bridge, it comes from
[org.apache.jena:jena-core|http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.jena%22%20AND%20a%3A%22jena-core%22]:2.11.2
([POM|https://repo1.maven.org/maven2/org/apache/jena/jena-core/2.11.2/jena-core-2.11.2.pom]),
which has as parent
[org.apache.jena:jena-parent|http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.jena%22%20AND%20a%3A%22jena-parent%22]:9
([POM|https://repo1.maven.org/maven2/org/apache/jena/jena-parent/9/jena-parent-9.pom]),
which declares slf4j-log4j12 as a (non-optional) dependency. Here the cleanest
solution would be to solve the problem in jena-parent (by adding the optional
keyword), and update dependency in org.apache.odftoolkit:odfdom-java from
org.apache.jena:jena-core:2.11.2 to a recent version of jena-core (otherwise of
course the change would have no effect for odftoolkit).
I this is not feasible, workarounds are of course possible.
was (Author: oliviercailloux):
Hi,
I believe I need help from someone who understands the structure of the
projects and the reasons these dependencies have been put there.
Here is the current dependency tree (rooted at simple-odf).
[INFO] +- org.apache.odftoolkit:simple-odf:jar:0.8.2-incubating:compile
[INFO] | +- org.apache.odftoolkit:odfdom-java:jar:0.8.11-incubating:compile
[INFO] | | +- org.apache.odftoolkit:taglets:jar:0.8.11-incubating:compile
[INFO] | | | \- com.sun:tools:jar:1.7.0:system
[INFO] | | +- org.apache.jena:jena-core:jar:2.11.2:compile
[INFO] | | | +- org.apache.jena:jena-iri:jar:1.0.2:compile
[INFO] | | | +- org.slf4j:slf4j-log4j12:jar:1.7.6:compile
[INFO] | | | \- log4j:log4j:jar:1.2.17:compile
[INFO] | | +- net.rootdev:java-rdfa:jar:0.4.2:compile
[INFO] | | \- commons-validator:commons-validator:jar:1.5.0:compile
[INFO] | | +- commons-beanutils:commons-beanutils:jar:1.9.2:compile
[INFO] | | +- commons-digester:commons-digester:jar:1.8.1:compile
[INFO] | | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | | \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] | +- xerces:xercesImpl:jar:2.9.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.3.04:compile
There are several ways to avoid imposing com.sun:tools on users of simple-odf.
Either make the dependency to com.sun:tools optional in
org.apache.odftoolkit:taglets, or make the dependency to taglets optional in
org.apache.odftoolkit:odfdom-java. Also possible: remove the dependency to
com.sun:tools in taglets, or make it appear only in the specific maven plugin
that needs it (if only some maven plugin needs it). The last solution would be
the cleanest one, but it very much depends on what you do with com.sun:tools
and why it is required in taglets, which I do not know.
About the org.slf4j:slf4j-log4j12 bridge, it comes from
[org.apache.jena:jena-core|http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.jena%22%20AND%20a%3A%22jena-core%22]:2.11.2
([POM|https://repo1.maven.org/maven2/org/apache/jena/jena-core/2.11.2/jena-core-2.11.2.pom]),
which has as parent
[org.apache.jena:jena-parent|http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.jena%22%20AND%20a%3A%22jena-parent%22]:9
([POM|https://repo1.maven.org/maven2/org/apache/jena/jena-parent/9/jena-parent-9.pom]),
which declares slf4j-log4j12 as a (non-optional) dependency. Here the cleanest
solution would be to solve the problem in jena-parent (by adding the optional
keyword), and update dependency in org.apache.odftoolkit:odfdom-java from
org.apache.jena:jena-core:2.11.2 to a recent version of jena-core (otherwise of
course the change would have no effect for odftoolkit).
I this is not feasible, workarounds are of course possible.
> 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)