[
https://issues.apache.org/jira/browse/SLING-12939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18020897#comment-18020897
]
Robert Munteanu commented on SLING-12939:
-----------------------------------------
Right, for now it is fine to rely on m2e 2.1.0 or newer, which is shipped with
Eclipse 2022-12. If m2e changes the API again we'll probably have to resort to
reflection.
> New Sling Bundle Project fails due to changes in internal m2e API
> -----------------------------------------------------------------
>
> Key: SLING-12939
> URL: https://issues.apache.org/jira/browse/SLING-12939
> Project: Sling
> Issue Type: Bug
> Components: IDE
> Reporter: Robert Munteanu
> Assignee: Robert Munteanu
> Priority: Critical
> Fix For: Sling Eclipse IDE 1.3.0
>
> Attachments: image-2025-09-12-17-51-43-864.png
>
>
> When attempting to create a new bundle using the wizard this fails with
> {noformat}
> java.lang.NoSuchMethodError: 'java.util.Collection
> org.eclipse.m2e.core.ui.internal.archetype.ArchetypeGenerator.createArchetypeProjects(org.eclipse.core.runtime.IPath,
> org.eclipse.m2e.core.project.IArchetype, java.lang.String, java.lang.String,
> java.lang.String, java.lang.String, java.util.Properties, boolean,
> org.eclipse.core.runtime.IProgressMonitor)'
> at
> org.apache.sling.ide.eclipse.ui.wizards.np.AbstractNewMavenBasedSlingApplicationWizard.createProjects(AbstractNewMavenBasedSlingApplicationWizard.java:130)
> at
> org.apache.sling.ide.eclipse.ui.wizards.AbstractNewSlingApplicationWizard$1.execute(AbstractNewSlingApplicationWizard.java:115)
> {noformat}
> !image-2025-09-12-17-51-43-864.png!
> We are still using internal APIs unfortunately and there was an API change in
> m2e.
> In m2e 2.0.0 the ArchetypeGenerator.createArchetypeProjects has the following
> signature (from
> https://github.com/eclipse-m2e/m2e-core/blob/db0d6d9043d569111515c7f1cb19c4427c9667e6/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/archetype/ArchetypeGenerator.java#L80-L81
> )
> {code:java}
> public Collection<MavenProjectInfo> createArchetypeProjects(IPath location,
> IArchetype archetype, String groupId,
> String artifactId, String version, String javaPackage, Properties
> properties, boolean interactive,
> IProgressMonitor monitor) throws CoreException {
> {code}
> whereas 2.9.1 (
> https://github.com/eclipse-m2e/m2e-core/blob/62e278dcca3372b39f98a832287192272c9f7536/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/archetype/ArchetypeGenerator.java#L119-L121
> ) has
> {code:java}
> public Collection<MavenProjectInfo> createArchetypeProjects(IPath location,
> IArchetype archetype, String groupId,
> String artifactId, String version, String javaPackage, Map<String,
> String> properties, boolean interactive,
> IProgressMonitor monitor) throws CoreException {
> {code}
> so the 'properties' argument type changed from Properties to Map.
> I would try and set up a minimal m2e version for the one with the {{Map}}
> argument. If the change is very recent and unnecessarily restricts the
> compatible m2e versions, we would need to resolve to reflection.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)