Unable to package with Maven and JSII

Hello,

I’m using JSII to package my TS Terraform CDK and publish it to a Github Maven repository. Unfortunately, I have been unable to package new versions of the module in the past couple of weeks due to an issue pulling the provider from Azurerm. I was wondering if this was a versioning issue between azurerm cdk provider and the cdktf cli. Do you have any thoughts regarding this?

Error

[jsii-pacmak] [WARN] Exception occurred, not cleaning up /tmp/npm-packcrDde0
[jsii-pacmak] [WARN] java failed
Error: All attempts failed. Last error: Command (mvn --quiet --batch-mode deploy -D=altDeploymentRepository=local::default::file:///tmp/npm-pack9Tmzuy --settings=user.xml) failed with status 1:
#STDERR> 
#STDOUT> [ERROR] Failed to execute goal on project <project>: Could not resolve dependencies for project com.platform.<package>:<project>:jar:7.0.4-rc.6: Failed to collect dependencies at com.hashicorp:cdktf-provider-azurerm:jar:[9.0.0,10.0.0): No versions available for com.hashicorp:cdktf-provider-azurerm:jar:[9.0.0,10.0.0) within specified range -> [Help 1]
#STDOUT> [ERROR] 
#STDOUT> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
#STDOUT> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
#STDOUT> [ERROR] 
#STDOUT> [ERROR] For more information about the errors and possible solutions, please read the following articles:
#STDOUT> [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
#STDOUT> 
    at retry (/workspaces/terraform-cdk-modules/node_modules/jsii-pacmak/lib/util.js:127:27)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Java.build (/workspaces/terraform-cdk-modules/node_modules/jsii-pacmak/lib/targets/java.js:308:9)
    at async /workspaces/terraform-cdk-modules/node_modules/jsii-pacmak/lib/targets/java.js:62:17
    at async Scratch.make (/workspaces/terraform-cdk-modules/node_modules/jsii-pacmak/lib/util.js:224:36)
    at async JavaBuilder.buildModules (/workspaces/terraform-cdk-modules/node_modules/jsii-pacmak/lib/targets/java.js:60:35)
    at async Promise.all (index 2)
    at async pacmak (/workspaces/terraform-cdk-modules/node_modules/jsii-pacmak/lib/index.js:67:9)

And I have these versions installed:

❯ cdktf debug
cdktf debug
language: typescript
cdktf-cli: 0.17.1
node: v18.16.0
cdktf: 0.17.1
constructs: 10.2.69
jsii: null
terraform: 1.4.6
arch: x64
os: linux 5.15.0-1041-azure

In my package.json, I use

    "jsii": "~5.1.7",
    "jsii-pacmak": "~1.84.0",

So I’m a bit confused why it says jsii is null here. Thanks for any help!

While running npx jsii-pacmak -v, I found this

#STDOUT> [INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/hashicorp/cdktf-provider-azurerm/maven-metadata.xml (10 kB at 1.0 MB/s)

that XML file is from 2021, though
<lastUpdated>20211218203913</lastUpdated>
And the latest version is
<release>0.4.24</release>. Maybe that’s causing the issue.

This was an issue with Maven. The CDK TF team opened a high prio ticket with Maven and the metadata file has been resolved.

1 Like