【问题标题】:Using IntelliJ Javac2 compiler instead of standard compiler in Gradle在 Gradle 中使用 IntelliJ Javac2 编译器而不是标准编译器
【发布时间】:2016-07-22 00:03:28
【问题描述】:

我有一个包含 IntelliJ 表单的项目,需要使用 javac2 编译器对其进行编译。这曾经作为 Ant 任务完成,如下所述:Ant task for compiling GUI forms (Intellij IDEA)

有没有办法在 Gradle 中用 javac2 编译器替换标准的 java 编译器?

【问题讨论】:

标签: java swing intellij-idea gradle


【解决方案1】:

这是我在 Gradle 中能做的最好的事情。 Java 类首先被编译,然后由 javac2 检测:

configurations {
    intellij
}

dependencies {
    intellij 'com.intellij:javac2:13'
}

compileJava {
    doLast() {
        project.ant.taskdef name: 'javac2', classname: 'com.intellij.ant.Javac2', classpath: project.configurations.intellij.asPath
        project.ant.javac2 srcdir: project.sourceSets.main.java.srcDirs.join(':'),
                includes: 'yourpackage/**/*.form',
                classpath: project.sourceSets.main.runtimeClasspath.asPath,
                destdir: project.sourceSets.main.output.classesDir,
                source: project.sourceCompatibility,
                target: project.targetCompatibility,
                includeAntRuntime: false,
                instrumentnotnull: project.ext.instrument
    }
}

【讨论】:

  • 您从哪个存储库下载com.intellij:javac2:13?它看起来不像最近的版本are in Maven Central
  • @Thunderforge 一定是在公司的本地缓存中。不知道,不能再检查了;)
  • 这似乎是我们所处的情况。我们正在迁移公司存储库,我们的旧存储库在缓存中,但我们找不到新的可以从中获取它的公共存储库。也许它在某个时候被删除了。
猜你喜欢
  • 1970-01-01
  • 2017-08-12
  • 2010-12-18
  • 1970-01-01
  • 2014-08-04
  • 2022-06-29
  • 1970-01-01
  • 2021-12-10
  • 2019-09-18
相关资源
最近更新 更多