FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Setting properties when creating Maven model for a BOM by suztomo · Pull Request #1037 · GoogleCloudPlatform/cloud-opensource-java · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.logging.Logger;
import org.apache.maven.RepositoryUtils;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
Expand Down Expand Up @@ -201,18 +202,25 @@ private static MavenProject createMavenProject(Path pomFile, RepositorySystemSes
.setJSR250Lifecycle(true)
.setName("linkage-checker");
try {
PlexusContainer container = new DefaultPlexusContainer(containerConfiguration);
PlexusContainer container = new DefaultPlexusContainer(containerConfiguration);

MavenExecutionRequest mavenExecutionRequest = new DefaultMavenExecutionRequest();
ProjectBuildingRequest projectBuildingRequest =
mavenExecutionRequest.getProjectBuildingRequest();
MavenExecutionRequest mavenExecutionRequest = new DefaultMavenExecutionRequest();
ProjectBuildingRequest projectBuildingRequest =
mavenExecutionRequest.getProjectBuildingRequest();

projectBuildingRequest.setRepositorySession(session);
projectBuildingRequest.setRepositorySession(session);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Lines above here had bad indentation.


ProjectBuilder projectBuilder = container.lookup(ProjectBuilder.class);
ProjectBuildingResult projectBuildingResult =
projectBuilder.build(pomFile.toFile(), projectBuildingRequest);
return projectBuildingResult.getProject();
// Profile activation needs properties such as JDK version
Properties properties = new Properties(); // allowing duplicate entries
properties.putAll(projectBuildingRequest.getSystemProperties());
properties.putAll(DependencyGraphBuilder.detectOsProperties());
properties.putAll(System.getProperties());
projectBuildingRequest.setSystemProperties(properties);

ProjectBuilder projectBuilder = container.lookup(ProjectBuilder.class);
ProjectBuildingResult projectBuildingResult =
projectBuilder.build(pomFile.toFile(), projectBuildingRequest);
return projectBuildingResult.getProject();
} catch (PlexusContainerException | ComponentLookupException | ProjectBuildingException ex) {
throw new MavenRepositoryException(ex);
}
Expand Down

Back | FazBrowse Home | New Git URL