Closed nkutsche closed 5 years ago
Try something like
<path id="phsch.path">
<fileset dir="../../../../target">
<include name="*-jar-with-dependencies.jar"/>
</fileset>
</path>
<taskdef name="schematron" classname="com.helger.schematron.ant.Schematron" classpathref="phsch.path" />
I am not an ANT expert :(
I am not an ANT expert :(
Me neither. But anything I tried, didn't worked. With path/fileset
, taskdef/@classpath
, taskdef/classpath
, etc. Every time the same result.
And something seems to work, because if I ommit the any classpath reference I get this (for sure):
taskdef class com.helger.schematron.ant.Schematron cannot be found
There is an open stackoverflow question about a very similar error message. Comment from Micheal Kay was:
Well you're definitely running Xalan rather than Saxon.
I can reproduce the error. It seems like a problem with created "JAR with dependencies". Maybe this is because ANT loads Xalan itself as the primary JAXP provider? I am investigating it
The reasons seems to be that Thread.currentThead ().getContextClassLoader()
is not returning the correct ANT class loader. When passing an explicit classloader to the TransformerFactory the ANTClassLoader
is used.
This is fixed in the 5.2.0 release
It's a pleasure to work with such a well-maintained open source project! It works perfect.
A star on the project is always appreciated :)
Hi,
In the documentation about declaring the ant task there is this paragraph:
At least in my case the "Alternative" does not work.
My ant script:
If I just call
cls && ant -f build.xml
I get this log:For some reasons it tries to use the Xalan? (
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
)If I call the same script with
cls && ant -lib=lib1.0 -f build.xml
it works:This leads in my case to nasty nested ant calls in my ant build scripts, because we need a simple ant call on the commandline. It works with such workarounds, but the "Alternative" with the classpath attribute would make it really cool.
Background infos:
Apache Ant(TM) version 1.10.6 compiled on May 2 2019
1.8.0_211