Skip to content

Commit

Permalink
chore(cli): fix Java dist integ tests (aws#5695) (aws#5699)
Browse files Browse the repository at this point in the history
The Java integ test which is run against the dist is failing because
the local `cdk-cx-api` Maven artifact cannot be found. Error message:

```
[ERROR] Failed to execute goal on project cdk-init-test: Could not
resolve dependencies for project com.myorg:cdk-init-test:jar:0.1: Failed
to collect dependencies at software.amazon.awscdk:core:jar:1.20.0 ->
software.amazon.awscdk:cdk-cx-api:jar:[1.20.0]: No versions available
for software.amazon.awscdk:cdk-cx-api:jar:[1.20.0] within specified
range -> [Help 1]
```

It is not clear to me why just this artifact cannot be found while for
example `core` can be found correctly, or why this problem only shows up
on the `release` branch, but after some reading of the Maven source and
local experimentation I have concluded that the proper filename of the
Maven metadata file should be `maven-metadata-local.xml` (instead of
just `maven-metadata.xml`), so we rename the files before rsync'ing them
into the repository now.
  • Loading branch information
rix0rrr authored and mergify[bot] committed Jan 7, 2020
1 parent 7270e0d commit 021c521
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/aws-cdk/test/integ/run-against-dist.bash
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ function prepare_java_packages() {
exit 1
fi

# Rename all maven-metadata.xml* files to maven-metadata-local.xml*
# This is necessary for Maven to find them correctly after we've rsync'ed
# them into place:
# https://github.com/sonatype/sonatype-aether/blob/master/aether-impl/src/main/java/org/sonatype/aether/impl/internal/SimpleLocalRepositoryManager.java#L114
for f in $(find $dist_root/java -name maven-metadata.xml\*); do
mv "$f" "$(echo "$f" | sed s/metadata\.xml/metadata-local.xml/)"
done

export MAVEN_CONFIG=${MAVEN_CONFIG:-$HOME/.m2}
rsync -a $dist_root/java/ ${MAVEN_CONFIG}/repository
}
Expand Down

0 comments on commit 021c521

Please sign in to comment.