diff --git a/devtools/cli/pom.xml b/devtools/cli/pom.xml
index b64095e318d228..fbdc2bd80c7d79 100644
--- a/devtools/cli/pom.xml
+++ b/devtools/cli/pom.xml
@@ -51,8 +51,8 @@
build
- prepare
- prepare-tests
+ generate-code
+ generate-code-tests
diff --git a/devtools/platform-descriptor-json-plugin/src/main/java/io/quarkus/maven/GenerateExtensionsJsonMojo.java b/devtools/platform-descriptor-json-plugin/src/main/java/io/quarkus/maven/GenerateExtensionsJsonMojo.java
index 27ea8f14feb0b3..c2bce724f3b0d9 100644
--- a/devtools/platform-descriptor-json-plugin/src/main/java/io/quarkus/maven/GenerateExtensionsJsonMojo.java
+++ b/devtools/platform-descriptor-json-plugin/src/main/java/io/quarkus/maven/GenerateExtensionsJsonMojo.java
@@ -59,7 +59,9 @@
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import io.quarkus.bootstrap.BootstrapConstants;
+import io.quarkus.bootstrap.resolver.maven.workspace.LocalWorkspace;
import io.quarkus.bootstrap.resolver.maven.workspace.ModelUtils;
+import io.quarkus.bootstrap.util.IoUtils;
import io.quarkus.bootstrap.util.ZipUtils;
import io.quarkus.dependencies.Extension;
import io.quarkus.platform.tools.ToolsConstants;
@@ -85,7 +87,7 @@ public class GenerateExtensionsJsonMojo extends AbstractMojo {
@Parameter(property = "overridesFile", defaultValue = "${project.basedir}/src/main/resources/extensions-overrides.json")
private String overridesFile;
- @Parameter(property = "outputFile", defaultValue = "${project.build.directory}/extensions.json")
+ @Parameter(property = "outputFile", defaultValue = "${project.build.directory}/${project.artifactId}-${project.version}-${project.version}.json")
private File outputFile;
@Component
@@ -270,7 +272,16 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}
info("Extensions file written to %s", outputFile);
- projectHelper.attachArtifact(project, jsonArtifact.getExtension(), jsonArtifact.getClassifier(), outputFile);
+ // this is necessary to sometimes be able to resolve the artifacts from the workspace
+ final File published = new File(project.getBuild().getDirectory(), LocalWorkspace.getFileName(jsonArtifact));
+ if (!outputDir.equals(published)) {
+ try {
+ IoUtils.copy(outputFile.toPath(), published.toPath());
+ } catch (IOException e) {
+ throw new MojoExecutionException("Failed to copy " + outputFile + " to " + published);
+ }
+ }
+ projectHelper.attachArtifact(project, jsonArtifact.getExtension(), jsonArtifact.getClassifier(), published);
}
private List dependencyManagementFromDescriptor(Artifact bomArtifact) throws MojoExecutionException {
diff --git a/devtools/platform-descriptor-json-plugin/src/main/java/io/quarkus/maven/PlatformPropertiesMojo.java b/devtools/platform-descriptor-json-plugin/src/main/java/io/quarkus/maven/PlatformPropertiesMojo.java
index 891cc73d845d00..1404e655e3a9b6 100644
--- a/devtools/platform-descriptor-json-plugin/src/main/java/io/quarkus/maven/PlatformPropertiesMojo.java
+++ b/devtools/platform-descriptor-json-plugin/src/main/java/io/quarkus/maven/PlatformPropertiesMojo.java
@@ -18,6 +18,7 @@
import org.apache.maven.project.MavenProjectHelper;
import io.quarkus.bootstrap.BootstrapConstants;
+import io.quarkus.bootstrap.util.IoUtils;
@Mojo(name = "platform-properties", threadSafe = true)
public class PlatformPropertiesMojo extends AbstractMojo {
@@ -83,7 +84,16 @@ public void execute() throws MojoExecutionException, MojoFailureException {
assertPlatformPropertiesInBom();
}
- projectHelper.attachArtifact(project, "properties", propsFile);
+ // this is necessary to sometimes be able to resolve the artifacts from the workspace
+ final File published = new File(project.getBuild().getDirectory(),
+ project.getArtifactId() + "-" + project.getVersion() + ".properties");
+ try {
+ IoUtils.copy(propsFile.toPath(), published.toPath());
+ } catch (IOException e) {
+ throw new MojoExecutionException("Failed to copy " + propsFile + " to " + published, e);
+ }
+
+ projectHelper.attachArtifact(project, "properties", published);
}
private void assertPlatformPropertiesInBom() throws MojoExecutionException {
diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java
index f6388ef51da10f..fc9affe6d9116a 100644
--- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java
+++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java
@@ -226,8 +226,6 @@ public boolean visitLeave(DependencyNode node) {
managedDeps = mergedManagedDeps;
}
- collectPlatformProperties(appBuilder, managedDeps);
-
final List repos = mvn.aggregateRepositories(managedRepos,
mvn.newResolutionRepositories(appArtifactDescr.getRepositories()));
@@ -254,7 +252,8 @@ public boolean visitLeave(DependencyNode node) {
} catch (RepositoryException e) {
throw new AppModelResolverException("Failed to normalize the dependency graph", e);
}
- final BuildDependencyGraphVisitor buildDepsVisitor = new BuildDependencyGraphVisitor(appDeps, buildTreeConsumer);
+ final BuildDependencyGraphVisitor buildDepsVisitor = new BuildDependencyGraphVisitor(appDeps, buildTreeConsumer,
+ repos);
buildDepsVisitor.visit(resolvedDeps);
final List requests = buildDepsVisitor.getArtifactRequests();
if (!requests.isEmpty()) {
@@ -275,6 +274,8 @@ public boolean visitLeave(DependencyNode node) {
}
}
+ collectPlatformProperties(appBuilder, managedDeps, repos);
+
List fullDeploymentDeps = new ArrayList<>(userDeps.size() + deploymentDeps.size());
fullDeploymentDeps.addAll(userDeps);
fullDeploymentDeps.addAll(deploymentDeps);
@@ -291,7 +292,8 @@ public boolean visitLeave(DependencyNode node) {
.build();
}
- private void collectPlatformProperties(AppModel.Builder appBuilder, List managedDeps)
+ private void collectPlatformProperties(AppModel.Builder appBuilder, List managedDeps,
+ List repos)
throws AppModelResolverException {
final Set descriptorKeys = new HashSet<>(4);
final Set propertyKeys = new HashSet<>(2);
@@ -307,7 +309,7 @@ private void collectPlatformProperties(AppModel.Builder appBuilder, List buildTreeConsumer;
private final List depth;
+ private final List repos;
private DependencyNode deploymentNode;
private DependencyNode runtimeNode;
@@ -30,7 +32,8 @@ public class BuildDependencyGraphVisitor {
private final List deploymentDepNodes = new ArrayList<>();
private final List requests = new ArrayList<>();
- public BuildDependencyGraphVisitor(Set appDeps, Consumer buildTreeConsumer) {
+ public BuildDependencyGraphVisitor(Set appDeps, Consumer buildTreeConsumer,
+ List repos) {
this.appDeps = appDeps;
this.buildTreeConsumer = buildTreeConsumer;
if (buildTreeConsumer == null) {
@@ -40,6 +43,7 @@ public BuildDependencyGraphVisitor(Set appDeps, Consumer
buf = new StringBuilder();
depth = new ArrayList<>();
}
+ this.repos = repos;
}
public List getDeploymentNodes() {
@@ -131,7 +135,7 @@ private void visitLeave(DependencyNode node) {
}
final Artifact artifact = dep.getArtifact();
if (artifact.getFile() == null) {
- requests.add(new ArtifactRequest(node));
+ requests.add(new ArtifactRequest(node).setRepositories(repos));
}
if (deploymentNode != null) {
if (runtimeNode == null && !appDeps.contains(new AppArtifactKey(artifact.getGroupId(),
diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java
index e4be1893c8fef4..d8c718c4dfe6df 100644
--- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java
+++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java
@@ -152,6 +152,12 @@ public File findArtifact(Artifact artifact) {
if (pom.exists()) {
return pom;
}
+ } else {
+ // check whether the artifact exists in the project's output dir
+ final Path path = lp.getOutputDir().resolve(getFileName(artifact));
+ if (Files.exists(path)) {
+ return path.toFile();
+ }
}
return null;
}
@@ -171,7 +177,7 @@ private boolean isFoundInLocalRepo(Artifact artifact) {
return Files.exists(p);
}
- private static String getFileName(Artifact artifact) {
+ public static String getFileName(Artifact artifact) {
final StringBuilder fileName = new StringBuilder();
fileName.append(artifact.getArtifactId()).append('-').append(artifact.getVersion());
if (!artifact.getClassifier().isEmpty()) {