Git Product home page Git Product logo

Comments (9)

fvarrui avatar fvarrui commented on July 30, 2024 1

Hi @streamingdv!

I planned to split some JP features into several Maven plugins and Gradle tasks, so you can combine them, e.g, you can call CreateAppTask, run your stuff, and then call GenerateInstallerTask. I think this could bring a lot of possibilities. JP internal logic is able to do this:

public void doPackage() throws Exception {
Packager packager = createPackager();
// generates app, installers and bundles
File app = packager.createApp();
List<File> installers = packager.generateInstallers();
List<File> bundles = packager.createBundles();
// sets generated files as output
outputFiles = new ArrayList<>();
outputFiles.add(app);
outputFiles.addAll(installers);
outputFiles.addAll(bundles);
}

Anyway, I'll try to reproduce your issue and find a simple solution or a workaround.

If you want to do some research by yourself, take a look into this:

protected File doApply(Packager packager) {
File libsFolder = new File(packager.getJarFileDestinationFolder(), "libs");
Project project = Context.getGradleContext().getProject();
copyLibsTask = (Copy) project.getTasks().findByName("copyLibs");
if (copyLibsTask == null) {
copyLibsTask = project.getTasks().create("copyLibs", Copy.class);
}
copyLibsTask.from(project.getConfigurations().getByName("runtimeClasspath"));
copyLibsTask.into(project.file(libsFolder));
copyLibsTask.getActions().forEach(action -> action.execute(copyLibsTask));
return libsFolder;
}

This is the snipet of code which copies dependencies in Gradle.

from javapackager.

fvarrui avatar fvarrui commented on July 30, 2024 1

It's explained here

from javapackager.

streamingdv avatar streamingdv commented on July 30, 2024 1

Thanks, it works now with the provided Snapshot. :)
I hope this will make it into the next release.

from javapackager.

fvarrui avatar fvarrui commented on July 30, 2024

Hi again!
I've managed to reproduce your issue:

C:\Users\fvarrui\GitHub\HelloWorldGradle>build\HelloWorldGradle\HelloWorldGradle.exe
Error occurred during initialization of boot layer
java.lang.module.FindException: Two versions of module javafx.graphics found in libs (javafx-graphics-22-win.jar and javafx-graphics-20.0.1-win.jar)

The problem is not about duplicated jars, but duplicated modules (javafx.graphics module is twice) ... what if you call your custom javafx.graphics.jar with the same name as the JAR which is being included by javafx-gradle-plugin ('javafx-graphics-22-win.jar), so it'll be ovewriten with your custom JavaFX jar. I've just released a SNAPSHOT version with DuplicatesStrategy=EXCLUDE when copying libraries to avoid this error: 1.7.6-20240421.230018-6 ... try it and give me some feedback, please.

from javapackager.

streamingdv avatar streamingdv commented on July 30, 2024

Could not find io.github.fvarrui:javapackager:1.7.6-20240421.230018-6
Which maven repo should I include in my gradle script in order to use the snapshot?

from javapackager.

fvarrui avatar fvarrui commented on July 30, 2024

New snapshot released: 1.7.6-20240423.010107-7.

Now duplicatesStrategy=WARN by default, but you can set a different duplicates strategy to your PackageTask:

tasks.register('packageApplication', PackageTask) {
    // mandatory
    mainClass = 'com.grill.app.Launcher'
    // optional
    bundleJre = true
    generateInstaller = true
    administratorRequired = false
    copyDependencies = true
    [...]
    duplicatesStrategy = DuplicatesStrategy.[EXCLUDE|FAIL|INCLUDE|INHERIT|WARN]
}

and this should work too:

tasks.configureEach {
    if (it instanceof Copy || it instanceof Zip || it instanceof Tar || it instanceof PackageTask) {
        it.duplicatesStrategy = DuplicatesStrategy.EXCLUDE
    }
}

from javapackager.

fvarrui avatar fvarrui commented on July 30, 2024

Please, let's keep this issue open untill it's released

from javapackager.

fvarrui avatar fvarrui commented on July 30, 2024

Branch issue-400 merged into devel, ready to be released in 1.7.6

from javapackager.

fvarrui avatar fvarrui commented on July 30, 2024

v1.7.6 released to Maven Central

from javapackager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.