Skip to content

Deploy whole installation via ant maven-install - #9779

Open
jtulach wants to merge 18 commits into
apache:masterfrom
jtulach:jtulach/MavenInstallForAll
Open

jtulach wants to merge 18 commits into
apache:masterfrom
jtulach:jtulach/MavenInstallForAll

Conversation

@jtulach

@jtulach jtulach commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Goals

  • make the Maven repository integration approachable to regular NetBeans developers
  • provide simple Ant command - e.g. ant maven-install to perform all the necessary work
  • let the main netbeans git repository contain references to all necessary components to perform (snapshot) release
  • verify the behavior during CI runs

Related Work

@jtulach
jtulach requested a review from ebarboni November 3, 2026 06:04
@jtulach jtulach self-assigned this Nov 3, 2026
@jtulach jtulach added Platform [ci] enable platform tests (platform/*) Ant [ci] enable "build tools" tests Release process PRs (eg. versions, sync) that are part of the release process and can be ignored in release notes. labels Nov 3, 2026
@neilcsmith-net neilcsmith-net removed the Release process PRs (eg. versions, sync) that are part of the release process and can be ignored in release notes. label Nov 3, 2026

@neilcsmith-net neilcsmith-net left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Generally good step. Couple of minor suggestions.

Should also consider whether we need mvnw as the target executable.

Removed reserved label. Release process is special-cased label for specific PRs.

Comment thread nbbuild/build.xml Resolved
Comment thread nbbuild/default-properties.xml Resolved
<action>
<label>Maven Install</label>
<target>maven-install</target>
</action>

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.

  • to promote the "Maven Install" capability more
  • let's expose the action in the popup menu of nbbuild project
Maven Install action

@jtulach

jtulach commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Generally good step. Couple of minor suggestions.

Should also consider whether we need mvnw as the target executable.

@eppleton eppleton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tried this locally on 278e2b8 with a built tree. The new top-level target looks good, but the changes to nbbuild/templates/projectized.xml break the existing per-module ant maven-install:

  1. ${repopluginversion} is undefined. The hardcoded 14.5 was replaced with a property that isn't defined anywhere. The new one is nbm.plugin.version. Running ant maven-install in platform/openide.awt:
    [exec] [ERROR] Plugin org.apache.netbeans.utilities:nb-repository-plugin:${repopluginversion} or one of its dependencies could not be resolved
    [exec] [INFO] BUILD FAILURE
    
  2. base.nbm.target.dir is now always set. It moved into default-properties.xml, which every module imports via default.xml. As a result, the <not><isset property="base.nbm.target.dir"/></not> condition in projectized.xml never applies anymore. A plain ant nbm in platform/openide.awt now writes platform/openide.awt/nbms/platform/org-openide-awt.nbm, a new untracked directory inside the module, instead of build/. It also breaks per-module maven-install: the antcall nbm with build.dir=${maven.tmp.nbms} no longer puts the NBM there, so build/mvn/nbms has no .nbm and build/mvn/install stays empty. Maybe keep the default in nbbuild/build.xml, or define it only when basedir is nbbuild.
  3. The mavenVersion default (dev-SNAPSHOT) was removed, but -DforcedVersion=${mavenVersion} is still used. Without -DmavenVersion=…, Maven gets the literal ${mavenVersion}. Should this be nbm.install.version as in build.xml?
  4. mavenArgs is defined and echoed, but never passed to <exec>. The echo claims arguments that weren't actually used.

Minor points:

  • The new target in build.xml calls plain mvn, which won't run on Windows without .cmd. projectized.xml uses the bundled ${maven.embedder.dir}/maven/bin/mvn${.cmd}. Using the same here would also cover the Maven 4 / mvnw concern without adding a wrapper.
  • Removing the apisupport action from nbbuild/nbproject/project.xml seems unrelated.
  • The closing </target> indentation in projectized.xml is off.

@jtulach

jtulach commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for a detailed review, @eppleton!

${repopluginversion} is undefined.

  • Oh, my god! Thanks for catching this.
  • Let's use the new nbm.plugin.version in 1904bd0
  • running netbeans$ grep -r repopluginversion * now yields empty result

mavenArgs is defined and echoed, but never passed to

mavenVersion

  • per @neilcsmith-net request the mavenVersion has been replaced
  • since 4a08e7a we are now using nbm.install.version consistently in both maven-install targets

base.nbm.target.dir is now always set.

Reverted in 4a08e7a - now we should be much closer to the original behavior before this PR was created. Toni, please check again. As far as I can say:

netbeans$ ant build-nbms

produces all NBMs in nbbuild/nbms directory (as it used to) and leaves no traces around. Installing to the local Maven repository then works:

netbeans$ ant maven-install -Dnbm.install.version=99-SNAPSHOT

properly populates the repository with 99-SNAPSHOT versions. Then:

netbeans$ rm -rf ~/.m2/repository/org/netbeans/api/org-openide-awt
netbeans$ ant -f platform/openide.awt/ maven-install -Dnbm.install.version=99-SNAPSHOT

succeeds and install new bits properly. I hope the @eppleton review will now find less mistakes. However it is true, given the set of regressions, we should have some tests. I'll think of creating some.

@jtulach
jtulach requested a review from eppleton November 12, 2026 09:26
@jtulach
jtulach dismissed neilcsmith-net’s stale review November 12, 2026 09:28

The changes were implemented

@neilcsmith-net

Copy link
Copy Markdown
Member

The new target in build.xml calls plain mvn, which won't run on Windows without .cmd. projectized.xml uses the bundled ${maven.embedder.dir}/maven/bin/mvn${.cmd}. Using the same here would also cover the Maven 4 / mvnw concern without adding a wrapper.

Actually I should have said Maven 3.10 or 4 concerns. At least one of our Maven plugins has issues with 3.10. If locked to the embedded version, this should probably wait, rebase and test on top of #9642 ? Can that property be overridden without breaking other things when invoking this? Or use a separate property that defaults to value of maven.embedder.dir?

Comment thread .github/workflows/main.yml Outdated

- name: Maven Install
run: |
# install all NBMs

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.

  • the huge list of issues reported by @eppleton deserves an action
  • not only we shall fix them (done already)
  • but we should prevent them to appear again
  • here is a CI change that attempts to do it
  • there already is "Build NBMs" check in the CI file...
  • ...hence adding few seconds ant maven-install shall be acceptable
  • it will give us basic confidence the tasks work

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes me think we need support for deployUrl, and to use somewhere isolated from the cache if you want to test this in CI.

cc/ @mbien thoughts?

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.

  • there already is "Build NBMs" check in the CI file...

  • ...hence adding few seconds ant maven-install shall be acceptable

  • it will give us basic confidence the tasks work

  • both ant maven-install and ant -f platform/openide.awt maven-install succeeds
  • and the pom.xml file is generated by the CI run

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So, checking CI caching we don't currently cache .m2, which would have made this test a no-go. However, given we might want to enable that in future, it's probably still a good idea to test this against an isolated pristine folder IMO.

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.

... given we might want to enable that in future ...

  • I don't understand why worry now? When someone needs, one can fix the test
  • the test is fine right now and moreover it uses "obscure" 99-SNAPSHOT
  • it would take next 15 years before (an unlikely) clash would really appear...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't understand why worry now? When someone needs, one can fix the test .. it would take next 15 years before (an unlikely) clash would really appear...

That's not the issue. My concern is cache sizes, which we hit limits on, and potentially caching unnecessary things. As @mbien says, we discussed and verified Maven repo isn't currently cached. I'd mis-remembered and thought the setup-java default was true.

only took a quick look at the CI file changes. Location is good - right job IMO.

Right job, wrong location, I think. This should probably go after the NBM build but before the Javadoc tests? They change the test environment dependent on the setting of the Javadoc label.

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.

Right job, wrong location, I think. This should probably go after the NBM build but before the Javadoc tests

  • the ant maven-install suggests to run three other jobs before being invoked
    • two of them (ant build-javadoc included) are optional
  • e.g. the ant maven-install should be executed after the "Javadoc tests"

They change the test environment dependent on the setting of the Javadoc label.

  • setting the Javadoc label then changes the behavior, but ...
  • ... it shall not change the result as having Javadoc is optional for ant maven-install

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Which changes both the test and the JDK it's running on, thus behaving differently between pull requests and merges.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Which changes both the test and the JDK it's running on, thus behaving differently between pull requests and merges.

good catch. overlooked that. +1 It should be moved above conditional tests which change the env.

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.

  • Is the testing of ant maven-install in CI the only remaining concern?
  • Then let it not stay in the way!
    • Moved the check in 82f6287
    • Right now it runs just after ant build-nbms (which is the only necessary per-requisite)
  • shall this continue to be a blocker, then let's remove the CI test from this PR altogether!

@mbien wrote:

this should be a unit test instead and install exactly one representative module.

  • I'd like to test this more through-fully and in a more standard way than in a GitHub Actions yaml file
  • I agree, writing it in .java would be better
    • either as a JUnit test somewhere (maybe some apisupport* module)?
    • or directly from GitHub Actions: run: java .github/scripts/CheckMavenInstall.java
  • but let's leave this for some other PR and move on with core changes

@jtulach
jtulach requested a review from mbien November 12, 2026 09:45
Comment thread nbbuild/build.xml
</target>

<target name="maven-install" depends="init,-init-sources-zip" description="Finishes installation of artifacts into Maven repository">
<echo message="=== Run only after ===${line.separator} ant build-source-zips${line.separator} ant build-nbms${line.separator} ant build-javadoc${line.separator}=== Only then maven-install ===${line.separator}"/>

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.

Suggests to run:

 ant build-source-zips
 ant build-nbms
 ant build-javadoc

but it doesn't run them to make the ant maven-install fast by itself.

With the most recent state of this PR the ant build-source-zips and ant build-javadoc are optional.

<condition property="nbm.distribution" value="${dist.base}/${nbm}"> <!-- compatibility -->
<isset property="dist.base"/>
</condition>
<property name="dist.base.structured" value="http://deadlock.netbeans.org/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms"/>

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.

If so, can we use the m2 URL protocol in all places that might want to consume this?

</condition>
<property name="dist.base.structured" value="http://deadlock.netbeans.org/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms"/>
<property name="nbm.distribution" value="${dist.base.structured}/${cluster.dir}/${nbm}"/>
<property name="nbm.distribution" value="m2:/org.netbeans.modules:${code.name.base.dashes}:${nbm.install.version}:nbm"/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The groupId is hardcoded to org.netbeans.modules, but nb-repository-plugin:populate puts modules with public packages under org.netbeans.api. E.g. after ant -f platform/openide.awt maven-install my local repo has only org/netbeans/api/org-openide-awt/dev-SNAPSHOT/, and there is no org/netbeans/modules/org-openide-awt. So m2:/org.netbeans.modules:org-openide-awt:dev-SNAPSHOT:nbm won't resolve for API modules. The JavaFX modules probably worked because they have no public packages.

Not a regression, since the deadlock URL didn't work either, but maybe the groupId should follow the same rule the plugin uses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ant [ci] enable "build tools" tests Platform [ci] enable platform tests (platform/*)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants