【发布时间】:2019-07-29 21:55:28
【问题描述】:
我是第一次尝试使用 gradle。我想要做的是将 ImageJ 与 gradle 一起使用。我从 imageJ 网站获取了示例文件,并从 imageJ github 上的示例中获取了 java 代码。 Gradle 说找不到为 imageJ 编译的方法。
gradle.build 中的代码如下:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
// classpath "io.spring.gradle:dependency-management-plugin:0.5.4.RELEASE"
classpath "io.spring.gradle:dependency-management-plugin:1.0.8.RELEASE"
}
}
apply plugin: "io.spring.dependency-management"
repositories {
jcenter()
maven {
url "http://maven.imagej.net/content/groups/public/"
}
}
dependencyManagement {
imports {
mavenBom 'net.imagej:pom-imagej:14.1.0'
}
}
dependencies {
compile 'net.imagej:imagej'
}
java代码在src/main/java中,如下:
package test;
import java.io.File;
import net.imagej.Dataset;
import net.imagej.ImageJ;
/** Loads and displays a dataset using the ImageJ API. */
public class LoadAndDisplayDataset {
public static void main(final String... args) throws Exception {
// create the ImageJ application context with all available services
final ImageJ ij = new ImageJ();
// ask the user for a file to open
final File file = ij.ui().chooseFile(null, "open");
// load the dataset
final Dataset dataset = ij.scifio().datasetIO().open(file.getPath());
// display the dataset
ij.ui().show(dataset);
}
}
当我运行gradle build 时,我收到以下错误:Could not find method compile() for arguments [net.imagej:imagej
【问题讨论】: