Saxon S9 API未使用Gradle中的本地罐子暴露

发布于 2025-01-18 03:04:40 字数 1764 浏览 1 评论 0原文

我想在 gradle 中本地包含 jar 文件,我创建了一个 libs 文件夹并在其中添加了 jar 文件。这些 jar 已添加到类路径中,但我无法访问 api。

my build.gradle :

plugins {
    id 'java'
    id 'io.github.lhotari.gradle-nar-plugin' version '0.5.1'
}

group 'com.acs.contentlake.nifi'
version '1.0'

repositories {

    mavenCentral()
    gradlePluginPortal()
    maven {
        url("https://mvnrepository.com/artifact/apache-xerces/resolver")
    }
    flatDir {
        dirs 'libs'
    }
}

compileJava{
    sourceCompatibility('8')
    targetCompatibility('8')
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
    implementation group: 'org.apache.nifi', name: 'nifi-api', version: '1.15.0'
    implementation group: 'org.apache.nifi', name: 'nifi-utils', version: '1.15.0'
//    implementation group: 'net.sf.saxon', name: 'Saxon-HE', version: '10.6'
    implementation group: 'xerces', name: 'xercesImpl', version: '2.9.1'
    implementation group: 'apache-xerces', name: 'resolver', version: '2.9.1'
    implementation 'org.codehaus.groovy:groovy-all:3.0.8'
//    implementation files('libs/saxon-ee-10.6.jar', 'icu4j-59.1.jar', 'jline-2.14.6.jar', 'saxon-ee-test-10.6.jar', 'saxon-sql-10.6.jar')
//    implementation fileTree(dir: 'libs', include: ['*.jar'])
//    implementation name: 'saxon-ee-10.6'
    implementation fileTree(include: ['*.jar'], dir: './libs/SaxonEE10-6J')
    testImplementation 'junit:junit:4.13.2'
    testImplementation 'org.apache.nifi:nifi-mock:1.15.0'

}

test {
    useJUnitPlatform()
}

我想使用 Saxon-EE jar,但在任何 Web 存储库上都没有。

我无法导入

import net.sf.saxon.s9api.*;

如果我使用 Saxon-HE 那么它工作正常,但我想使用任何网络存储库上都没有的许可版本

I want to include jar files locally in gradle, I have created a libs folder and added the jars there. the jars are added to the class path but I am not able to access the api.

my build.gradle :

plugins {
    id 'java'
    id 'io.github.lhotari.gradle-nar-plugin' version '0.5.1'
}

group 'com.acs.contentlake.nifi'
version '1.0'

repositories {

    mavenCentral()
    gradlePluginPortal()
    maven {
        url("https://mvnrepository.com/artifact/apache-xerces/resolver")
    }
    flatDir {
        dirs 'libs'
    }
}

compileJava{
    sourceCompatibility('8')
    targetCompatibility('8')
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
    implementation group: 'org.apache.nifi', name: 'nifi-api', version: '1.15.0'
    implementation group: 'org.apache.nifi', name: 'nifi-utils', version: '1.15.0'
//    implementation group: 'net.sf.saxon', name: 'Saxon-HE', version: '10.6'
    implementation group: 'xerces', name: 'xercesImpl', version: '2.9.1'
    implementation group: 'apache-xerces', name: 'resolver', version: '2.9.1'
    implementation 'org.codehaus.groovy:groovy-all:3.0.8'
//    implementation files('libs/saxon-ee-10.6.jar', 'icu4j-59.1.jar', 'jline-2.14.6.jar', 'saxon-ee-test-10.6.jar', 'saxon-sql-10.6.jar')
//    implementation fileTree(dir: 'libs', include: ['*.jar'])
//    implementation name: 'saxon-ee-10.6'
    implementation fileTree(include: ['*.jar'], dir: './libs/SaxonEE10-6J')
    testImplementation 'junit:junit:4.13.2'
    testImplementation 'org.apache.nifi:nifi-mock:1.15.0'

}

test {
    useJUnitPlatform()
}

I want to use Saxon-EE jars which are not available on any web repo.

I am unable to import

import net.sf.saxon.s9api.*;

If I use Saxon-HE then it is working fine, but I want to use the licensed edition which is not available on any web repo

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凌乱心跳 2025-01-25 03:04:40

猜测,filetree(包括:['*.jar'],dir:'./libs/saxonee10-6j')没有做您认为的事情。我通常在此时尝试调试gradle文件是创建一个“ helloworld”任务,该任务打印了classpath

// Testing task for various Gradle debugging efforts
task helloWorld() {
  doLast {
    /*
    configurations.jsbuild.resolve().each { path ->
      println(path)
    }
     */
    println("Hello, world.")
  }
}

: <代码>实现

。将其添加到您的存储库中关闭:

  maven { url "https://dev.saxonica.com/maven" }

然后您只需加载EE即可:

    implementation 'com.saxonica:Saxon-EE:10.6'

At a guess, fileTree(include: ['*.jar'], dir: './libs/SaxonEE10-6J') isn't doing what you think it is. What I usually do at this point trying to debug Gradle files is create a "helloWorld" task that prints the classpath:

// Testing task for various Gradle debugging efforts
task helloWorld() {
  doLast {
    /*
    configurations.jsbuild.resolve().each { path ->
      println(path)
    }
     */
    println("Hello, world.")
  }
}

(Where you have to uncomment the lines and replace jsbuild with a local configuration that you derive from implementation. I don't think you can access the implementation classpath directly for reasons I doubt I fully understand.)

However, I can make this all much easier for you. Add this to your repositories closure:

  maven { url "https://dev.saxonica.com/maven" }

And then you can just load EE with Maven:

    implementation 'com.saxonica:Saxon-EE:10.6'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文