question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for Java

See original GitHub issue

Proposed change

Add support for installing Java and Java build tools.

Relevant package managers:

  • Maven triggered by pom.xml
  • Ant triggered by build.xml
  • Gradle triggered by gradle.build

What the BuildPack would do is

  • install Java (anything speaking against always installing the JDK?), matching the version configured in the configuration file
    • Java 8, 11, 12, and 13 are available from default sources, which seems enough options
$ docker run --rm -it buildpack-deps:bionic apt-get update && apt-cache search openjdk | grep Kit
[..]                                                  
Fetched 17.1 MB in 15s (1115 kB/s)                                                                                                            
Reading package lists... Done
default-jdk - Standard Java or Java compatible Development Kit
default-jdk-doc - Standard Java or Java compatible Development Kit (documentation)
default-jdk-headless - Standard Java or Java compatible Development Kit (headless)
openjdk-11-doc - OpenJDK Development Kit (JDK) documentation
openjdk-11-jdk - OpenJDK Development Kit (JDK)
openjdk-11-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-11-source - OpenJDK Development Kit (JDK) source files
openjdk-12-doc - OpenJDK Development Kit (JDK) documentation
openjdk-12-jdk - OpenJDK Development Kit (JDK)
openjdk-12-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-12-source - OpenJDK Development Kit (JDK) source files
openjdk-13-doc - OpenJDK Development Kit (JDK) documentation
openjdk-13-jdk - OpenJDK Development Kit (JDK)
openjdk-13-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-13-source - OpenJDK Development Kit (JDK) source files
openjdk-8-doc - OpenJDK Development Kit (JDK) documentation
openjdk-8-jdk - OpenJDK Development Kit (JDK)
openjdk-8-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-8-source - OpenJDK Development Kit (JDK) source files
  • install the build tool
  • run the build tool (Is there a need or a good way to define the used options?)

Alternative options

Users would have to install Java and build tools/project managers manually, e.g. using postBuild.

Who would use this feature?

Java users.

How much effort will adding it take?

Depending on how many build tools are supported (could of course be added later) I guess 2 days of work. A good part of that would be to create different project configurations for tests.

Who can do this work?

Somebody familiar with BuildPacks and Java, and the different Java build tools.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
nuestcommented, Feb 3, 2020

I might have a good reason to try this out early next year, just adding a few notes. There are options to run Java from Jupyter Notebooks, one of which should be included by default.

IJava already somehow supports Binder! https://mybinder.org/v2/gh/SpencerPark/ijava-binder/master?urlpath=lab/tree/home/jovyan/3rdPartyDependency.ipynb > https://github.com/SpencerPark/ijava-binder has a custom Dockerfile.

Pinging @SpencerPark - have you thought about adding Java support natively in repo2docker? Just want to make sure I’m not missing any big obstacles here.

1reaction
betatimcommented, Apr 18, 2020

A build pack is a class in repo2docker that does two things. 1) it has a method that when pointed at a directory can decide if this build pack should be applied and 2) a method that generates statements that should be added in the Dockerfile repo2docker generates. In more detail: https://repo2docker.readthedocs.io/en/latest/architecture.html#buildpacks

“adding it natively” means that as a user I wouldn’t have to write a Dockerfile any more. Placing for example a pom.xml at the root of my repository would be enough to trigger the installation of the jdk, ijava and packages listed in the pom.xml file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Oracle Java SE Embedded Support in NetBeans IDE
In this tutorial, you will learn how to get started with Java SE Embedded in NetBeans IDE and how to use the IDE...
Read more >
How do I enable Java in my web browser?
Open the Firefox browser or restart it, if it is already running · From the Firefox menu, select Tools then click the Add-ons...
Read more >
Language Support for Java(TM) by Red Hat
Provides Java ™ language support via Eclipse ™ JDT Language Server, which utilizes Eclipse ™ JDT, M2Eclipse and Buildship. Quick Start. Install the...
Read more >
Use Java 8 language features and APIs - Android Developers
This additional support for older platform versions is possible because plugin 4.0.0 and higher extends the desugaring engine to also desugar Java language...
Read more >
TIP: How to Add Java 14 Support for Eclipse 2020-03 - YouTube
Quick steps to enable compiling Java 14 code in Eclipse IDE.Notes:- Eclipse can run under JDK 14 but its compiler won't compile Java...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found