Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
278 views
in Technique[技术] by (71.8m points)

javafxports - compile and build gluon mobile app for desktop

we have

desktopRuntime 'org.xerial:sqlite-jdbc:3.15.1'

in gradle file. i build project but my zip file dont have this file in lib folder. how can i build project for desktop? my ide is netbeans. Thankful.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The problem with the distZip or jar gradle tasks is they miss to include desktop dependencies.

When deploying to desktop you can change temporary desktopRuntime to runtime, so they will be included, as Ladislav T?r?k suggests, but then you should undo the change so that dependency isn't included in the mobile deployment.

If you want to have a working zip, we have to modify the distZip task, to include the desktop dependencies in the lib folder, and also to include them in the class path (so they are also added to the scripts in the bin folder). Include this in your build.gradle script:

startScripts {
    classpath += configurations.desktopRuntime
}

distZip {
    into("$project.name/lib") {
        from configurations.desktopRuntime
    }
}

You can also solve the issue by using the shadowJar, providing you include the desktop dependencies, to create an executable fat jar, like in this solution.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...