R
Railway2y ago
snöw

How to exclude a default nixpack package from the build?

I'm trying to deploy a Spring Boot application which uses JDK11. Railway incorrectly detected JDK8, causing the build to fail. I added NIXPACKS_PKGS=jdk11, which added jdk11 to the build setup, but didn't remove jdk8 This means that the build is now failing due to this collision error:
error: collision between `/nix/store/hm60khc9q9lgajyl4y3ddsvh7k9qxflb-openjdk-8u322-ga/lib/openjdk/lib/jexec' and `/nix/store/mcawqibgxc0yl4h4b7g9cjnlrwmqwwdz-openjdk-11.0.15+10/lib/openjdk/lib/jexec'
error: collision between `/nix/store/hm60khc9q9lgajyl4y3ddsvh7k9qxflb-openjdk-8u322-ga/lib/openjdk/lib/jexec' and `/nix/store/mcawqibgxc0yl4h4b7g9cjnlrwmqwwdz-openjdk-11.0.15+10/lib/openjdk/lib/jexec'
How can I remove JDK8 from the build setup? Or is there a better way of defining the JDK version?
8 Replies
Percy
Percy2y ago
Project ID: 51267194-e20e-4c89-9270-89caaecaa531
Percy
Percy2y ago
You can remove JDK8 from the build setup by setting the NIXPACKS_PKGS environment variable to jdk11 instead of jdk. This will ensure that only JDK11 is used in the build setup.
⚠️ experimental feature
snöw
snöwOP2y ago
51267194-e20e-4c89-9270-89caaecaa531 push @Angelo or anyone else?
angelo
angelo2y ago
Oh this is interesting, tagging in @coffeecup
jr
jr2y ago
You can now customize the JDK version that gets installed with the NIXPACKS_JDK_VERSION environment variable. In your case you can set it to 11. This should override the automatically provided one and prevent any collisions https://nixpacks.com/docs/providers/java
Java | Nixpacks
App source + Nix packages + Docker = Image
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Adam
Adam2y ago
Enter the variable mentioned in jr’s message above in the environments variable tab in your service on Railway
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server