Skip to content

Commit

Permalink
Merge pull request #651 from gsmet/quarkus-2.13.2
Browse files Browse the repository at this point in the history
Upgrade to Quarkus 2.13.2.Final
  • Loading branch information
gsmet authored Oct 12, 2022
2 parents 2dcecc2 + 0db090d commit 51a3c13
Show file tree
Hide file tree
Showing 8 changed files with 1,353 additions and 1,336 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2585,12 +2585,12 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.19.3</version>
<version>3.19.6</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.19.3</version>
<version>3.19.6</version>
</dependency>
<dependency>
<groupId>io.grafeas</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.BuildBase;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.apache.maven.model.Profile;
Expand Down Expand Up @@ -90,6 +91,8 @@
import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.bootstrap.resolver.BootstrapAppModelResolver;
import io.quarkus.bootstrap.resolver.maven.BootstrapMavenContext;
import io.quarkus.bootstrap.resolver.maven.BootstrapMavenContextConfig;
import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver;
import io.quarkus.bootstrap.resolver.maven.options.BootstrapMavenOptions;
import io.quarkus.bootstrap.util.BootstrapUtils;
Expand Down Expand Up @@ -741,7 +744,6 @@ private String getSourceEncoding() {
}

private void addProject(MavenDevModeLauncher.Builder builder, ResolvedDependency module, boolean root) throws Exception {

if (!module.isJar()) {
return;
}
Expand Down Expand Up @@ -1060,30 +1062,37 @@ private QuarkusDevModeLauncher newLauncher() throws Exception {
if (appModel != null) {
bootstrapProvider.close();
} else {
final MavenArtifactResolver.Builder resolverBuilder = MavenArtifactResolver.builder()
final BootstrapMavenContextConfig<?> mvnConfig = BootstrapMavenContext.config()
.setRemoteRepositories(repos)
.setRemoteRepositoryManager(remoteRepositoryManager)
.setWorkspaceDiscovery(true)
.setPreferPomsFromWorkspace(true)
.setCurrentProject(project.getFile().toString());

// if it already exists, it may be a reload triggered by a change in a POM
// in which case we should not be using the original Maven session
boolean reinitializeMavenSession = Files.exists(appModelLocation);
if (reinitializeMavenSession) {
// if a serialized model is found, it may be a reload triggered by a change in a POM
// in which case we should not be using the original Maven session initialized with the previous POM version
if (Files.exists(appModelLocation)) {
Files.delete(appModelLocation);
// we can't re-use the repo system because we want to use our interpolating model builder
// a use-case where it fails with the original repo system is when dev mode is launched with -Dquarkus.platform.version=xxx
// overriding the version of the quarkus-bom in the pom.xml
} else {
// we can re-use the original Maven session
resolverBuilder.setRepositorySystemSession(repoSession).setRepositorySystem(repoSystem);
// we can re-use the original Maven session and the system
mvnConfig.setRepositorySystemSession(repoSession).setRepositorySystem(repoSystem);
// there could be Maven extensions manipulating the project versions and models
// the ones returned from the Maven API could be different from the original pom.xml files
final Map<Path, Model> projectModels = new HashMap<>(session.getAllProjects().size());
for (MavenProject mp : session.getAllProjects()) {
projectModels.put(mp.getBasedir().toPath(), mp.getOriginalModel());
}
mvnConfig.setProjectModelProvider(projectModels::get);
}

appModel = new BootstrapAppModelResolver(resolverBuilder.build())
final BootstrapMavenContext mvnCtx = new BootstrapMavenContext(mvnConfig);
appModel = new BootstrapAppModelResolver(new MavenArtifactResolver(mvnCtx))
.setDevMode(true)
.setCollectReloadableDependencies(!noDeps)
.resolveModel(ArtifactCoords.jar(project.getGroupId(), project.getArtifactId(), project.getVersion()));
.resolveModel(mvnCtx.getCurrentProject().getAppArtifact());
}

// serialize the app model to avoid re-resolving it in the dev process
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
Expand All @@ -14,6 +16,7 @@
import java.util.concurrent.ExecutionException;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Model;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.component.annotations.Component;
Expand Down Expand Up @@ -132,16 +135,21 @@ private MavenArtifactResolver artifactResolver(QuarkusBootstrapMojo mojo, Launch
throws MojoExecutionException {
isWorkspaceDiscovery(mojo);
try {
return MavenArtifactResolver.builder()
.setWorkspaceDiscovery(
mode == LaunchMode.DEVELOPMENT || mode == LaunchMode.TEST || isWorkspaceDiscovery(mojo))
final MavenArtifactResolver.Builder builder = MavenArtifactResolver.builder()
.setCurrentProject(mojo.mavenProject().getFile().toString())
.setPreferPomsFromWorkspace(mode == LaunchMode.DEVELOPMENT || mode == LaunchMode.TEST)
.setRepositorySystem(repoSystem)
.setRepositorySystemSession(mojo.repositorySystemSession())
.setRemoteRepositories(mojo.remoteRepositories())
.setRemoteRepositoryManager(remoteRepoManager)
.build();
.setRemoteRepositoryManager(remoteRepoManager);
if (mode == LaunchMode.DEVELOPMENT || mode == LaunchMode.TEST || isWorkspaceDiscovery(mojo)) {
final Map<Path, Model> projectModels = new HashMap<>(mojo.mavenSession().getAllProjects().size());
for (MavenProject mp : mojo.mavenSession().getAllProjects()) {
projectModels.put(mp.getBasedir().toPath(), mp.getOriginalModel());
}
builder.setWorkspaceDiscovery(true).setProjectModelProvider(projectModels::get);
}
return builder.build();
} catch (BootstrapMavenException e) {
throw new MojoExecutionException("Failed to initialize Quarkus bootstrap Maven artifact resolver", e);
}
Expand Down
Loading

0 comments on commit 51a3c13

Please sign in to comment.