首页 > 解决方案 > 将单独编译的类文件添加到 JavaFXPorts apk

问题描述

我有一个带有 gradle-clojure 和 javafxports 插件的 build.gradle 文件。它编译得很好,但我确实有一个问题:

编译的 Clojure 类文件放在build/clojure/main. 由于 javafxports 不知道这一点,我最终得到了一个 APK 文件,其中包含除实际项目类文件之外的所有内容。

我如何告诉 Gradle/JavaFXPorts 在打包时包含这些文件?

这是我当前的 build.gradle:

buildscript {
    repositories {
        jcenter()
        google()
        maven {
            url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
        }
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:1.3.15'
    }
}

plugins {
  id 'gradle-clojure.clojure' version '0.4.0'
  id 'application'
  id 'com.github.johnrengelman.shadow' version '2.0.4'
  id 'maven-publish'
}

repositories {
    mavenCentral()
    maven {
        name = 'clojars'
        url = 'https://repo.clojars.org'
    }
}

dependencies {
    compile 'org.clojure:clojure:1.9.0'
    compile 'clojurefx:clojurefx:0.5.0-SNAPSHOT'

    testImplementation 'junit:junit:4.12'

    devImplementation 'org.clojure:tools.namespace:0.3.0-alpha4'
}

apply plugin: 'org.javafxports.jfxmobile'

group = 'lyrion'
version = '0.1.0-SNAPSHOT'

mainClassName = 'lyrion.cec'


clojure {
  builds {
    main {
      aotAll()
    }
  }
}

jfxmobile {
    javafxportsVersion = '8.60.9'
    downConfig {
        version = '3.8.5'
        plugins 'cache', 'device', 'lifecycle', 'orientation', 'settings', 'storage'
    }
    android {
        dexOptions {
            javaMaxHeapSize "4g"
        }

        packagingOptions {
            exclude 'project.clj'
        }

        applicationPackage = 'lyrion'
    }
}

publishing {
  publications {
    shadow(MavenPublication) { publication ->
      project.shadow.component(publication)
    }
  }
  repositories {
    maven {
      name = 'clojars'
      url = 'https://repo.clojars.org'
      credentials {
        username = System.env['CLOJARS_USER']
        password = System.env['CLOJARS_PASSWORD']
      }
    }
  }
}

标签: androidgradlejavafxclojurejavafxports

解决方案


推荐阅读