-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generated Utilities.java file does not use the language.java.basePackage property #1110
Comments
i can confirm this. the result in my case is: static {
var resourceName = "com/pulumi/proxmoxve/version.txt";
var versionFile = Utilities.class.getClassLoader().getResourceAsStream(resourceName);
if (versionFile == null) {
throw new IllegalStateException(
String.format("expected resource '%s' on Classpath, not found", resourceName)
);
}
version = new BufferedReader(new InputStreamReader(versionFile))
.lines()
.collect(Collectors.joining("\n"))
.trim();
}
as far as i can tell this is due to https://github.com/pulumi/pulumi-java/blob/main/pkg/codegen/java/gen.go#LL1759C60-L1759C60 where similar to #1118 this is preventing third-party publishers. |
Is there any update on this work? Cheers |
Hi, same pb for me and it's a blocker for my company (OVHcloud) to use this part of Pulumi |
Having a Quick Look, the version.txt is generated by gradle in https://github.com/hansbarnard/pulumi-test-java/blob/main/sdk/java/build.gradle#L65 - which is based on project.name which for this project is based on https://github.com/hansbarnard/pulumi-test-java/blob/main/sdk/java/settings.gradle#L13 which is also generated apparently https://github.com/pulumi/pulumi-java/blob/main/pkg/codegen/java/templates_gradle.go#L139 via https://github.com/pulumi/pulumi-java/blob/main/pkg/codegen/java/settings.gradle.template#L13 |
<!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> Fixes #1110 ## Checklist <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have updated the [CHANGELOG-PENDING](https://github.com/pulumi/pulumi/blob/master/CHANGELOG_PENDING.md) file with my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Service, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version <!-- @pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
Thanks @tmeckel for the fix! |
What happened?
I set the java
basePackage
property in theschema.json
file as follows:When using this plugin the generated java SDK fails with an Exception because it cannot find the file
version.txt
. It is expecting the file on the classpath atcom/pulumi/ipidp/version.txt
. Instead this file is on the classpath atcom/pulumi/xxxxx/version.txt
.The problem is that the generated java class
sdk/java/src/main/java/com/xxxxx/ipidp/Utilities.java
is hardcoded to expect this file atcom/pulumi/ipidp/version.txt
.Expected Behavior
The generated java class
sdk/java/src/main/java/com/xxxxx/ipidp/Utilities.java
should use thebasePackage
property to resolve theversion.txt
file.Steps to reproduce
Clone the repo https://github.com/hansbarnard/pulumi-test-java, and execute
make build_java
.Inspect line 78 in the generated
Utilities.java
file: https://github.com/hansbarnard/pulumi-test-java/blob/main/sdk/java/src/main/java/com/xxxxx/ipidp/Utilities.java#L78Output of
pulumi about
Not applicable
Additional context
Using java-gen v0.9.3
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
The text was updated successfully, but these errors were encountered: