Skip to content

Add a warning when an entry provided with "--classpath" does not exists - #330

Open
jmini wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
jmini:add-warning
Open

Add a warning when an entry provided with "--classpath" does not exists#330
jmini wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
jmini:add-warning

Conversation

@jmini

@jmini jmini commented Mar 26, 2025

Copy link
Copy Markdown

I lost a lot of time because I had a typo in the jar listed as --classpath value when running the command:

java -jar java-function-invoker-<version>.jar \
  --classpath build/my-function-1.0.0-SNAPSHOT-runner.jar \
  --target io.quarkus.gcp.functions.QuarkusHttpFunction

I think it would make sense to add a warning to help users (like me) realizing they added an invalid entry on the list provided with --classpath.

@jmini jmini closed this Mar 26, 2025
@jmini jmini reopened this Mar 26, 2025

@akerekes akerekes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @jmini for the PR.

Can you adjust the test at

to cover this case?

urls.addAll(jarsIn(component.substring(0, component.length() - 2)));
} else {
Path path = Paths.get(component);
if(!Files.isRegularFile(path)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will emit the warning on existing directories.

@jmini

jmini commented Nov 6, 2025

Copy link
Copy Markdown
Author

@akerekes any inputs on how the test InvokerTest#.classpathToUrls() can be extended, because I can not do assertions on the log-entries, right?

@akerekes

akerekes commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

@jmini would an approach like https://stackoverflow.com/a/1828268 work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants