args4J 不适用于 gradle

args4J doesn't work with gradle

我是 gradle 的新手,所以这可能是一个明显的问题:

我将 eclipse 与 gradle 一起使用,实际上我在为 junit 或其他东西添加依赖项时没有问题,它将 junit 库添加到 gradle 依赖项并且使用 junit 没有问题,但是如果我尝试使用 args4j(也添加依赖项),它就不起作用。

只是为了确保 build.gradle

没有问题
apply plugin: 'java'
apply plugin: 'eclipse'

sourceCompatibility = 1.8
version = '1.0'
jar {
    manifest {
        attributes 'Implementation-Title': 'title', 
        'Implementation-Version': version,
        'Main-Class':'path.to.main.Main'
    }
}

repositories {
    mavenCentral()
}

test {
    systemProperties 'property': 'value'
}

dependencies{
    compile 'args4j:args4j-site:2.0.25'
    testCompile group: 'junit', name: 'junit', version: '4.+'
}

不,我没有使用标题或 path.to.main ^^

Eclipse 显示无法解析导入 (args4j)

您忘记了主要 "args4j" 模块:

compile group: 'args4j',             name: 'args4j',        version: '2.0.25'
compile group: 'args4j',             name: 'args4j-site',   version: '2.0.25'

gradle-7.1 这对我有用:

// build.gradle

repositories {
    mavenCentral()
}

dependencies {
    implementation group: 'args4j',    name: 'args4j',         version: '2.33'
    implementation group: 'args4j',    name: 'args4j-site',    version: '2.33'
}