This is an automated email from the ASF dual-hosted git repository.
skygo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 501ddbe [NETBEANSINFRA-6] get latest archetype from maven repo (#1999)
501ddbe is described below
commit 501ddbe80da33b06f21a2ff8eb63a73df5d20fec
Author: oyarzun <[email protected]>
AuthorDate: Sat Mar 7 08:14:18 2020 -0500
[NETBEANSINFRA-6] get latest archetype from maven repo (#1999)
* [NETBEANS-3332] Get the latest nbm-archetype and
netbeans-platform-app-archetype versions from the maven repository.
---
.../maven/apisupport/NbmWizardIterator.java | 23 +++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git
a/apisupport/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NbmWizardIterator.java
b/apisupport/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NbmWizardIterator.java
index 65a15f7..12bd22f 100644
---
a/apisupport/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NbmWizardIterator.java
+++
b/apisupport/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NbmWizardIterator.java
@@ -51,6 +51,8 @@ import org.openide.util.NbBundle.Messages;
import static org.netbeans.modules.maven.apisupport.Bundle.*;
import static
org.netbeans.modules.maven.apisupport.MavenNbModuleImpl.APACHE_SNAPSHOT_REPO_ID;
import org.netbeans.modules.maven.embedder.EmbedderFactory;
+import org.netbeans.modules.maven.indexer.api.NBVersionInfo;
+import org.netbeans.modules.maven.indexer.api.RepositoryQueries;
import org.netbeans.spi.project.ui.support.CommonProjectActions;
public class NbmWizardIterator implements
WizardDescriptor.BackgroundInstantiatingIterator<WizardDescriptor> {
@@ -113,7 +115,21 @@ public class NbmWizardIterator implements
WizardDescriptor.BackgroundInstantiati
LBL_CreateProjectStepNbm()
};
}
-
+
+ private static void getLatestArchetypeVersion(Archetype archetype) {
+ RepositoryQueries.Result<NBVersionInfo> versionsResult =
RepositoryQueries.getVersionsResult(archetype.getGroupId(),
archetype.getArtifactId(), null);
+
+ if (versionsResult.isPartial()) {
+ versionsResult.waitForSkipped();
+ }
+
+ // Versions are sorted in descending order
+ List<NBVersionInfo> results = versionsResult.getResults();
+ if (!results.isEmpty()) {
+ archetype.setVersion(results.get(0).getVersion());
+ }
+ }
+
@Override
public Set<FileObject> instantiate() throws IOException {
ProjectInfo vi = new ProjectInfo((String) wiz.getProperty("groupId"),
(String) wiz.getProperty("artifactId"), (String) wiz.getProperty("version"),
(String) wiz.getProperty("package")); //NOI18N
@@ -127,10 +143,11 @@ public class NbmWizardIterator implements
WizardDescriptor.BackgroundInstantiati
Map<String,String> additional =
Collections.singletonMap("netbeansVersion", version); // NOI18N
if (archetype == NB_MODULE_ARCH) {
+ getLatestArchetypeVersion(NB_MODULE_ARCH);
NBMNativeMWI.instantiate(vi, projFile, version,
Boolean.TRUE.equals(wiz.getProperty(OSGIDEPENDENCIES)), null);
-
+
} else {
-
+ getLatestArchetypeVersion(NB_APP_ARCH);
ArchetypeWizards.createFromArchetype(projFile, vi, archetype,
additional, true);
List<ModelOperation<POMModel>> opers = new
ArrayList<ModelOperation<POMModel>>();
if (Boolean.TRUE.equals(wiz.getProperty(OSGIDEPENDENCIES))) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists