Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,7 @@ public int getColumnNumber() {
public String getLocation() {
StringBuilder buffer = new StringBuilder(256);

if (getSource().length() > 0) {
if (buffer.length() > 0) {
buffer.append(", ");
}
if (!getSource().isEmpty()) {
buffer.append(getSource());
}

Expand Down Expand Up @@ -205,13 +202,6 @@ public List<Exception> getExceptions() {
public Node getRoot() {
return session.getNode(r.getDependencyGraph());
}

// @Override
// public List<ArtifactResolverResult>
// getArtifactResults()
// {
// return Collections.emptyList();
// }
});
}
};
Expand Down
1,278 changes: 641 additions & 637 deletions maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ public String getUserProperty(String key) {
}

@Override
public Model getRawModel(String groupId, String artifactId) throws IllegalStateException {
public Model getRawModel(Path from, String groupId, String artifactId) throws IllegalStateException {
throw new UnsupportedOperationException();
}

@Override
public Model getRawModel(Path p) {
public Model getRawModel(Path from, Path p) {
throw new UnsupportedOperationException();
}

Expand Down
5 changes: 5 additions & 0 deletions maven-model-builder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ under the License.
<exclude>org.apache.maven.model.building.ModelCache#put(org.apache.maven.building.Source,java.lang.String,java.lang.Object):METHOD_NEW_DEFAULT</exclude>
<exclude>org.apache.maven.model.building.ModelCache#put(org.apache.maven.building.Source,org.apache.maven.model.building.ModelCacheTag,java.lang.Object):METHOD_NEW_DEFAULT</exclude>
<exclude>org.apache.maven.model.building.ModelCache#put(java.lang.String,java.lang.String,java.lang.String,org.apache.maven.model.building.ModelCacheTag,java.lang.Object):METHOD_NEW_DEFAULT</exclude>
<exclude>org.apache.maven.model.building.ModelCache#computeIfAbsent(java.lang.String,java.lang.String,java.lang.String,org.apache.maven.model.building.ModelCacheTag,java.util.function.Supplier):METHOD_NEW_DEFAULT</exclude>
<exclude>org.apache.maven.model.building.ModelCache#computeIfAbsent(org.apache.maven.building.Source,org.apache.maven.model.building.ModelCacheTag,java.util.function.Supplier):METHOD_NEW_DEFAULT</exclude>
<exclude>org.apache.maven.model.composition.DependencyManagementImporter#importManagement(org.apache.maven.model.Model,java.util.List,org.apache.maven.model.building.ModelBuildingRequest,org.apache.maven.model.building.ModelProblemCollector):METHOD_REMOVED</exclude>
<exclude>org.apache.maven.model.composition.DefaultDependencyManagementImporter#importManagement(org.apache.maven.model.Model,java.util.List,org.apache.maven.model.building.ModelBuildingRequest,org.apache.maven.model.building.ModelProblemCollector):METHOD_REMOVED</exclude>
<exclude>org.apache.maven.model.inheritance.DefaultInheritanceAssembler</exclude>
Expand All @@ -165,6 +167,9 @@ under the License.
<exclude>org.apache.maven.model.profile.activation.FileProfileActivator#setProfileActivationFilePathInterpolator(org.apache.maven.model.path.ProfileActivationFilePathInterpolator):METHOD_REMOVED</exclude>
<exclude>org.apache.maven.model.profile.activation.FileProfileActivator#FileProfileActivator():CONSTRUCTOR_REMOVED</exclude>
<exclude>org.apache.maven.model.profile.DefaultProfileInjector</exclude>
<exclude>org.apache.maven.model.profile.ProfileInjector#injectProfile(org.apache.maven.api.model.Model,org.apache.maven.api.model.Profile,org.apache.maven.model.building.ModelBuildingRequest,org.apache.maven.model.building.ModelProblemCollector):METHOD_NEW_DEFAULT</exclude>
<exclude>org.apache.maven.model.profile.ProfileInjector#injectProfiles(org.apache.maven.api.model.Model,java.util.List,org.apache.maven.model.building.ModelBuildingRequest,org.apache.maven.model.building.ModelProblemCollector):METHOD_NEW_DEFAULT</exclude>
<exclude>org.apache.maven.model.profile.ProfileSelector#getActiveProfilesV4(java.util.Collection,org.apache.maven.model.profile.ProfileActivationContext,org.apache.maven.model.building.ModelProblemCollector):METHOD_NEW_DEFAULT</exclude>
<exclude>org.apache.maven.model.resolution.InvalidRepositoryException#getRepository():METHOD_RETURN_TYPE_CHANGED</exclude>
<exclude>org.apache.maven.model.resolution.InvalidRepositoryException#InvalidRepositoryException(java.lang.String,org.apache.maven.model.Repository,java.lang.Throwable):CONSTRUCTOR_REMOVED</exclude>
<exclude>org.apache.maven.model.resolution.InvalidRepositoryException#InvalidRepositoryException(java.lang.String,org.apache.maven.model.Repository):CONSTRUCTOR_REMOVED</exclude>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void handleParent(Path pomFile, TransformerContext context, Model model) {
String path = Optional.ofNullable(parent.getRelativePath()).orElse("..");
if (version == null && !path.isEmpty()) {
Optional<RelativeProject> resolvedParent = resolveRelativePath(
pomFile.getParent(), context, Paths.get(path), parent.getGroupId(), parent.getArtifactId());
pomFile, context, Paths.get(path), parent.getGroupId(), parent.getArtifactId());
resolvedParent.ifPresent(relativeProject -> parent.setVersion(relativeProject.getVersion()));
}
}
Expand Down Expand Up @@ -99,7 +99,8 @@ void handleCiFriendlyVersion(TransformerContext context, Model model) {
void handleReactorDependencies(TransformerContext context, Model model) {
for (Dependency dep : model.getDependencies()) {
if (dep.getVersion() == null) {
Model depModel = context.getRawModel(dep.getGroupId(), dep.getArtifactId());
Model depModel =
context.getRawModel(model.getDelegate().getPomFile(), dep.getGroupId(), dep.getArtifactId());
if (depModel != null) {
String v = depModel.getVersion();
if (v == null && depModel.getParent() != null) {
Expand All @@ -124,8 +125,8 @@ protected String replaceCiFriendlyVersion(TransformerContext context, String ver
}

protected Optional<RelativeProject> resolveRelativePath(
Path projectPath, TransformerContext context, Path relativePath, String groupId, String artifactId) {
Path pomPath = projectPath.resolve(relativePath).normalize();
Path pomFile, TransformerContext context, Path relativePath, String groupId, String artifactId) {
Path pomPath = pomFile.resolveSibling(relativePath).normalize();
if (Files.isDirectory(pomPath)) {
pomPath = context.locate(pomPath);
}
Expand All @@ -134,7 +135,7 @@ protected Optional<RelativeProject> resolveRelativePath(
return Optional.empty();
}

Optional<RelativeProject> mappedProject = Optional.ofNullable(context.getRawModel(pomPath.normalize()))
Optional<RelativeProject> mappedProject = Optional.ofNullable(context.getRawModel(pomFile, pomPath.normalize()))
.map(BuildModelSourceTransformer::toRelativeProject);

if (mappedProject.isPresent()) {
Expand Down
Loading