← Back to issue list

Runtime/build-time discrepancies with jdk and ant plugins

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1477745
Type
issue
State
closed
Author
~lool
Labels
first-steps
Created
Updated
Closed

Current evaluation

Migrated to canonical/snapcraft#15 and closed by sergiusens (2019) as handled by 3.x base support: ant gained base/build-env handling (#2370, #2453 jre defaults) and the jdk plugin was removed in merged PR #2376 (b556781ad); ant later switched to the ant snap by default (14d12bbb3).

Resolution: closed resolved

Reason: ~sergiusens closed it on 2019-01-24 stating "Everything has been taken care of in 3.x and triggered when using bases." The requested build/runtime separation landed via base support in PR #2370 and jre default fixes in PR #2453, and merged PR #2376 (commit b556781ad) deleted the deprecated jdk plugin, with the change noted in the 3.0 release notes.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Hi, While testing ant and jdk plugins, I noticed a couple of things; this bug to discuss the best resolution. First, I was surprized by a "jdk" plugin; I actually thought the plugin would be "jre" because I thought it was just embedding a java runtime. But then I noticed that "ant" wasn't working on my system, compilation would fail with missing javac classes. This is because the ant Ubuntu package doesn't pull a JDK but only a JRE. Yet, ant was run successfully during a snapcraft build. This is because ant was being run with the java runtime pulled by the jdk plugin (from the snap). I found this surprizing, I was actually expecting the ant package would be used on my system against the java runtime on my system, but I can see how there are pros and cons to using system java vs. snap's java. Pros of using system jdk to run ant and embedding a jre package in the snap: - smaller runtime -- the current approach still ends up embedding a bunch of lib*.a files, lib*.so (including X.org libs) - feels more natural (to me) Cons: - ant doesn't pull a jdk by default - more complex to digest (more plugins) Pros of using snap's jdk to run ant: - less copies of java around -- no discrepancies, perhaps less waster space (not sure) - less plugins To make the matter more complex, I believe we should have multiple architecture in mind. This problem will get worse when we're considering building packages across architectures and/or for multiple architectures. This is actually quite common in the "develop on x86-64 Ubuntu desktop, deploy on ARM board" scenario. This last topic is actually what convinces me we should go for using the system JDK to run ant rather than the snap's JDK. This makes the snap less easily bloated with JDK bits (we could offer regular vs. -headless jre as an option to make this even smaller), and means we dont need to worry about cross-architecture. It's even relatively easy to support multiple architectures if we stop relying on default-java and rather use java-7-openjdk-amd64 and such. (BTW, we seem to pull Recommends; it's not clear whether it's a good default given these are usually not pulled when building .deb packages) Hence, I propose we: - change the ant plugin to pull the default-jdk package (on top of the ant package) -- this kind of feels like a workaround for the package not pulling the jdk by default which is either a bug or just a packaging opinion that "ant can be used for anything, not necessarily building java sources" - rename the jdk plugin to jre -- possibly ubuntu-jre or openjdk-jre, allowing for oracle-jre and similar, but I find the long names look ugly (- add an option to select the headless JRE) - differentiate between build and runtime envs But happy to read other opinions! Cheers,

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Migrated to canonical/snapcraft#15 and closed by sergiusens (2019) as handled by 3.x base support: ant gained base/build-env handling (#2370, #2453 jre defaults) and the jdk plugin was removed in merged PR #2376 (b556781ad); ant later switched to the ant snap by default (14d12bbb3).
stealth/space-bunny-alpha — closed resolved Resolved in Snapcraft 3.x: base support replaced the old jdk-plugin flow, and merged PR #2376 (b556781ad) removed the jdk plugin while Ant/JRE defaults were corrected.
stealth/space-bunny-alpha — closed stale No direct fix was recorded; the jdk plugin was later removed in #2376 (b556781ad), and #2453 corrected JRE defaults for Ant, Maven and Gradle.
qwen/qwen3.6-35b-a3b — — Closed without resolution or comments. The proposal to modify ant and jdk plugin behavior to resolve runtime and build-time discrepancies was abandoned. No implementation or follow-up occurred.
qwen/qwen3.6-35b-a3b — — Proposals to rename jdk to jre, update ant to pull default-jdk, and separate build/runtime environments were closed without discussion. The request was abandoned due to prolonged inactivity and no resolution.

Update history

Date Change
created

Related work

  • Superseded By: canonical/snapcraft#15 (confidence 95%)

    LP bug was migrated by ~elopio (2015-10-30) to this GitHub issue, which carried the same title and discussion.

  • Likely Fixed By: canonical/snapcraft#2376 (confidence 92%)

    Merged PR 'jdk plugin: remove jdk' (commit b556781ad) deleted the jdk plugin lool asked to rename/replace; noted in Snapcraft 3.0 release notes, resolving LP #1794788.

  • Likely Fixed By: canonical/snapcraft#2370 (confidence 85%)

    'ant plugin: add support for bases' implements the build/runtime environment differentiation requested in the issue.

  • Likely Fixed By: canonical/snapcraft#2453 (confidence 82%)

    'ant, maven and gradle plugins: use correct defaults for jre' corrects the runtime JRE handling raised as the discrepancy here.

  • Related To: snapcraft#14d12bbb3 (confidence 70%)

    Later change making the ant plugin use the ant snap for building by default, the opposite direction to lool's proposed system-JDK approach.

Related issues

Issue Project State Summary Similarity
#2597 ant plugin: switch to using ant snap for building (by default) snapcraft merged Merged in snapcraft#2597 (14d12bbb3), switching the Ant plugin to build with the ant snap by default while retaining ant-version with checksum as an alternative.
76%
#15 Runtime/build-time discrepancies with jdk and ant plugins snapcraft closed Closed after a maintainer said it appeared fixed and requested a reproducer; no resolving PR, commit, or release was identified, and LP1477745 was closed as unimplemented.
71%