0

私はGradleプラグインを作成しています

スペースがあるproject.dependenciesコンパイルへのjarパスを設定しようとすると、例外が発生します

* What went wrong:
A problem occurred evaluating root project 'visage-gradle-sample'.
> No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.compile() is applicable for argument types: (org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection) values: [file collection]
Possible solutions: module(java.lang.Object)

MyPlugin apply メソッドで設定しようとしています

    private void configureSetup(project) {


    final javafxHome = System.env["JAVAFX_HOME"]

    def jfxJar =''

    if (javafxHome) {
        jfxJar = "${javafxHome}${File.separator}rt${File.separator}lib${File.separator}jfxrt.jar"
    }
    else{
        final javaHome = System.env["JAVA_HOME"]
        jfxJar = "${javaHome}${File.separator}jre${File.separator}lib${File.separator}jfxrt.jar"
    }

    if(!(new File(jfxJar)).exists())
    throw new StopExecutionException("JAVAFX_HOME is not set or your JDK is not having JAVAFX jar.")

        project.dependencies  {
          compile project.files(jfxJar)
    }

}

次のパスにあるJavaFX 2 jfxrt.jarを設定しようとしています

 C:\Program Files\Oracle\JavaFX 2.1 SDK\rt\lib\jfxrt.jar

デバッグが示しています

 15:36:31.036 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: groovy.lang.MissingMethodException: No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.compile() is applicable for argument types: (org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection) values: [file collection]
 Possible solutions: module(java.lang.Object)
 15:36:31.051 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.methodMissing(DefaultDependencyHandler.groovy:94)
 15:36:31.067 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.invokeMethod(DefaultDependencyHandler.groovy)
 15:36:31.082 [ERROR] [org.gradle.BuildExceptionReporter]        at org.visage.gradle.plugin.VisagePlugin$_configureSetup_closure1.doCall(VisagePlugin.groovy:122)
 15:36:31.098 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:141)
 15:36:31.114 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:90)
 15:36:31.129 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.AbstractProject.dependencies(AbstractProject.java:879)
 15:36:31.129 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.Project$dependencies.call(Unknown Source)
 15:36:31.160 [ERROR] [org.gradle.BuildExceptionReporter]        at org.visage.gradle.plugin.VisagePlugin.configureSetup(VisagePlugin.groovy:121)
 15:36:31.176 [ERROR] [org.gradle.BuildExceptionReporter]        at org.visage.gradle.plugin.VisagePlugin.this$2$configureSetup(VisagePlugin.groovy)
 15:36:31.176 [ERROR] [org.gradle.BuildExceptionReporter]        at org.visage.gradle.plugin.VisagePlugin$this$2$configureSetup.callCurrent(Unknown Source)
 15:36:31.207 [ERROR] [org.gradle.BuildExceptionReporter]        at org.visage.gradle.plugin.VisagePlugin.apply(VisagePlugin.groovy:67)
 15:36:31.207 [ERROR] [org.gradle.BuildExceptionReporter]        at org.visage.gradle.plugin.VisagePlugin.apply(VisagePlugin.groovy)
 15:36:31.223 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.providePlugin(DefaultProjectsPluginContainer.java:107)
 15:36:31.239 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.addPluginInternal(DefaultProjectsPluginContainer.java:71)
 15:36:31.254 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.apply(DefaultProjectsPluginContainer.java:37)
 15:36:31.270 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)
 15:36:31.285 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)
 15:36:31.301 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)
 15:36:31.317 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)
 15:36:31.348 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.AbstractProject.apply(AbstractProject.java:840)
 15:36:31.364 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.Project$apply.call(Unknown Source)
 15:36:31.379 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
 15:36:31.395 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.Script$apply.callCurrent(Unknown Source)
 15:36:31.410 [ERROR] [org.gradle.BuildExceptionReporter]        at build_1c4c4h5n90lk41hinuth6in4rk.run(D:\MyWorkBench\jugchennai\visage-gradle-plugin\visage-gradle-sample\build.gradle:8)
 15:36:31.410 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
 15:36:31.426 [ERROR] [org.gradle.BuildExceptionReporter]        ... 29 more
 15:36:31.442 [ERROR] [org.gradle.BuildExceptionReporter]
 15:36:31.457 [LIFECYCLE] [org.gradle.BuildResultLogger]

パスのスペースを克服する方法は?

4

1 に答える 1

4

問題がパス内のスペースに関連しているようには見えません。javaコードはプラグインを適用しないと想定しているため、compile構成はありません。

ちなみに、File.separatorGradle にパスを渡す場合は使用する必要はありません。使用するだけ/で、Gradle は正しいことを行います。

于 2012-06-29T15:29:26.397 に答える