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.

Expose classpath, main class, and other variables for reference from an explicit entrypoint

See original GitHub issue

Following on to #579 where it would be useful to be able to somehow reference the computed classpath from within an entrypoint definition.

For example, on Gradle:

jib {
  container {
    entrypoint = ['/opt/startup.sh', '-classpath', classpath.join(':'), '-jvmflags', '"' + jvmFlags.join(' ') + '"']
  }
}

Would we want users to be able to change the classpath? Should we expose the computed main-class?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

7reactions
chanseokohcommented, Jun 14, 2021

@remmeier @mfriedenhagen @leonard84 @dtreskunov @OneCricketeer @tellisnz-shift @seanabraham @tomikmar @flobjective

Previously we suggested an extension approach to the issue. With Jib 3.1.1 that we just released, we claim that the issue can be finally resolved with a reasonably good option.

Jib 3.1.1 creates two new JVM argument files inside an image, where they hold the computed classpath and the main class respectively. It will be trivial to retrieve these values from a shell. See the doc for more details.

5reactions
briandealwiscommented, Apr 30, 2019

We’re contemplating adding support for surefire-style @{property} resolving (e.g., @{jib.container.mainClass}). These properties would be expanded for the entrypoint, command arguments, and environment variables, allowing something like:

<container>
  <environment>
   <MAINCLASS>@{jib.container.mainClass}</MAINCLASS>
   <CLASSPATH>@{jib.container.classpath}</CLASSPATH>
  </environment>
</container>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting an Application's Entry Point (The Java™ Tutorials ...
We want to execute the main method in the class MyClass in the package MyPackage when we run the JAR file. We first...
Read more >
Topical Guide | Spring Boot Docker
Using an ENTRYPOINT with an explicit shell (as the preceding example does) means that you can pass environment variables into the Java command....
Read more >
Building applications with Maven - Quarkus
The entry point of the application. This can either be a fully qualified name of a standard Java class with a main method,...
Read more >
How to run a class from Jar which is not the Main-Class in its ...
And if you want all jars in current directory on classpath too (eg. running Main class from lib directory) you can use java...
Read more >
Gradle Docker Plugin User Guide & Examples - GitHub Pages
Want to learn more about using this plugin in different contexts? ... A unique main class name discovered by scanning the classpath.
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