forked from eclipse-m2e/m2e-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve conflict handling of lifecycle mappings eclipse-m2e#549
- record what is causing the conflict - add the exception to the maven problem - show problem markers at the correct location in the pom Signed-off-by: Christoph Läubrich <[email protected]>
- Loading branch information
Showing
7 changed files
with
217 additions
and
38 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...clipse/m2e/core/internal/lifecyclemapping/DuplicateLifecycleMappingMetadataException.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Christoph Läubrich and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Christoph Läubrich - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.m2e.core.internal.lifecyclemapping; | ||
|
||
import java.util.Arrays; | ||
|
||
import org.eclipse.m2e.core.internal.lifecyclemapping.model.LifecycleMappingMetadata; | ||
import org.eclipse.m2e.core.internal.lifecyclemapping.model.LifecycleMappingMetadataSource; | ||
|
||
|
||
/** | ||
* DuplicateLifecycleMappingMetadataException | ||
* | ||
*/ | ||
public class DuplicateLifecycleMappingMetadataException extends DuplicateMappingException { | ||
|
||
private LifecycleMappingMetadata[] lifecyclemappings; | ||
|
||
public DuplicateLifecycleMappingMetadataException(LifecycleMappingMetadata... lifecyclemappings) { | ||
super(Arrays.stream(lifecyclemappings).map(LifecycleMappingMetadata::getSource) | ||
.toArray(LifecycleMappingMetadataSource[]::new)); | ||
this.lifecyclemappings = lifecyclemappings; | ||
} | ||
|
||
/** | ||
* @return Returns the lifecyclemappings. | ||
*/ | ||
public LifecycleMappingMetadata[] getConflictingMappings() { | ||
return this.lifecyclemappings; | ||
} | ||
|
||
} |
This file contains 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
42 changes: 42 additions & 0 deletions
42
...eclipse/m2e/core/internal/lifecyclemapping/DuplicatePluginExecutionMetadataException.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Christoph Läubrich and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Christoph Läubrich - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.m2e.core.internal.lifecyclemapping; | ||
|
||
import java.util.Arrays; | ||
|
||
import org.eclipse.m2e.core.internal.lifecyclemapping.model.LifecycleMappingMetadataSource; | ||
import org.eclipse.m2e.core.internal.lifecyclemapping.model.PluginExecutionMetadata; | ||
|
||
|
||
/** | ||
* DuplicatePluginExecutionMetadataException | ||
* | ||
*/ | ||
public class DuplicatePluginExecutionMetadataException extends DuplicateMappingException{ | ||
|
||
private PluginExecutionMetadata[] pluginExecutionMetadatas; | ||
|
||
public DuplicatePluginExecutionMetadataException(PluginExecutionMetadata... pluginExecutionMetadatas) { | ||
super( | ||
Arrays.stream(pluginExecutionMetadatas).map(PluginExecutionMetadata::getSource) | ||
.toArray(LifecycleMappingMetadataSource[]::new)); | ||
this.pluginExecutionMetadatas = pluginExecutionMetadatas; | ||
} | ||
|
||
/** | ||
* @return Returns the sources. | ||
*/ | ||
public PluginExecutionMetadata[] getConflictingMetadata() { | ||
return this.pluginExecutionMetadatas; | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
....core/src/org/eclipse/m2e/core/internal/lifecyclemapping/FailedMappingMetadataSource.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Christoph Läubrich and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Christoph Läubrich - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.m2e.core.internal.lifecyclemapping; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.m2e.core.internal.lifecyclemapping.model.LifecycleMappingMetadata; | ||
import org.eclipse.m2e.core.internal.lifecyclemapping.model.PluginExecutionMetadata; | ||
import org.eclipse.m2e.core.project.configurator.MojoExecutionKey; | ||
|
||
|
||
/** | ||
* FailedMappingMetadataSource | ||
* | ||
*/ | ||
public class FailedMappingMetadataSource implements MappingMetadataSource { | ||
|
||
private DuplicateMappingException failure; | ||
|
||
private MappingMetadataSource source; | ||
|
||
/** | ||
* @param source | ||
* @param failure | ||
*/ | ||
public FailedMappingMetadataSource(MappingMetadataSource source, DuplicateMappingException e) { | ||
this.source = source; | ||
this.failure = e; | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see org.eclipse.m2e.core.internal.lifecyclemapping.MappingMetadataSource#getLifecycleMappingMetadata(java.lang.String) | ||
*/ | ||
@Override | ||
public LifecycleMappingMetadata getLifecycleMappingMetadata(String packagingType) throws DuplicateMappingException { | ||
throw failure; | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see org.eclipse.m2e.core.internal.lifecyclemapping.MappingMetadataSource#getPluginExecutionMetadata(org.eclipse.m2e.core.project.configurator.MojoExecutionKey) | ||
*/ | ||
@Override | ||
public List<PluginExecutionMetadata> getPluginExecutionMetadata(MojoExecutionKey execution) { | ||
return source.getPluginExecutionMetadata(execution); | ||
} | ||
|
||
/** | ||
* @return Returns the failure. | ||
*/ | ||
public DuplicateMappingException getFailure() { | ||
return this.failure; | ||
} | ||
|
||
/** | ||
* @return Returns the source. | ||
*/ | ||
public MappingMetadataSource getSource() { | ||
return this.source; | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
Oops, something went wrong.