Skip to content

Commit

Permalink
Merge pull request #580 from dnestoro/dnestoro/SetProperDefaultMetada…
Browse files Browse the repository at this point in the history
…taCopyDir

Update Default Target Directory for MetadataCopy Task
  • Loading branch information
dnestoro authored Mar 21, 2024
2 parents c791bf6 + 5f8ca42 commit 6db59ba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/src/docs/snippets/gradle/groovy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ graalvmNative {
// Copies metadata collected from tasks into the specified directories.
metadataCopy {
inputTaskNames.add("test") // Tasks previously executed with the agent attached.
outputDirectories.add("src/main/resources/META-INF/native-image")
outputDirectories.add("src/main/resources/META-INF/native-image/<groupId>/<artifactId>/") // Replace <groupId> and <artifactId> with GAV coordinates of your project
mergeWithExisting = true // Instead of copying, merge with existing metadata in the output directories.
}

Expand Down
2 changes: 1 addition & 1 deletion docs/src/docs/snippets/gradle/kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ graalvmNative {
// Copies metadata collected from tasks into the specified directories.
metadataCopy {
inputTaskNames.add("test") // Tasks previously executed with the agent attached.
outputDirectories.add("src/main/resources/META-INF/native-image")
outputDirectories.add("src/main/resources/META-INF/native-image/<groupId>/<artifactId>/") // Replace <groupId> and <artifactId> with GAV coordinates of your project
mergeWithExisting.set(true) // Instead of copying, merge with existing metadata in the output directories.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ public void execute() throws MojoExecutionException {
String buildDirectory = project.getBuild().getDirectory() + "/native/agent-output/";
String destinationDir = config.getOutputDirectory();
if (destinationDir == null) {
destinationDir = project.getBuild().getOutputDirectory() + DEFAULT_OUTPUT_DIRECTORY;
destinationDir = project.getBuild().getOutputDirectory()
.concat(DEFAULT_OUTPUT_DIRECTORY).concat("/")
.concat(project.getGroupId()).concat("/")
.concat(project.getArtifactId());
}

if (!Files.isDirectory(Paths.get(destinationDir))) {
Expand Down

0 comments on commit 6db59ba

Please sign in to comment.