Expose classpath, main class, and other variables for reference from an explicit entrypoint
See original GitHub issueFollowing 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:
- Created 5 years ago
- Reactions:8
- Comments:15 (8 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
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: