timboudreau / netbeans-local-maven-repo-populator

Populate your local Maven repository with modules from a Netbeans source build
4 stars 1 forks source link

Question: create a new platform app from NB IDE using the self-built platform #2

Open chhh opened 5 years ago

chhh commented 5 years ago

I've built just the platform cluster and installed it into local maven repo with a little change to your script:
ant -Dcluster.config=platform build-nozip build-nbms build-source-zips build-javadoc I called in RELEASE123 and I see the nbms in the local .m2 repo. In NB IDE 11.2-beta3 I force-updated the maven index. But when I try File -> New project -> Java with Maven -> NetBeans Application on step 3 (Module Options) NetBeans Verions dropdown doesn't list this platform as available.

timboudreau commented 5 years ago

Try a restart. Or maybe this is hard coded in the plugin - not sure. I recall manually changing it when creating new modules, but I don't know if the plugin ever offers it or if I ever checked.

If you change your dependencies to use it in your pom files (hint: use a property in the parent pom so you only have to change it in one place), they will work fine.

It also may simply be that the plugin can show it but sorting alphabetically not lexically, so RELEASE9 > RELEASE1.

-Tim

On Wed, Oct 16, 2019 at 6:36 PM Dmitry Avtonomov notifications@github.com wrote:

I've built just the platform cluster and installed it into local maven repo with a little change to your script: ant -Dcluster.config=platform build-nozip build-nbms build-source-zips build-javadoc I called in RELEASE123 and I see the nbms in the local .m2 repo. In NB IDE 11.2-beta3 I force-updated the maven index. But when I try File -> New project -> Java with Maven -> NetBeans Application on step 3 (Module Options) NetBeans Verions dropdown doesn't list this platform as available.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/timboudreau/netbeans-local-maven-repo-populator/issues/2?email_source=notifications&email_token=AAOQE56RN6X5EJEINYPPRODQO6JNHA5CNFSM4JBR3CTKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HSJQ3BQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOQE54T6P4JRTSSZI2ENBTQO6JNHANCNFSM4JBR3CTA .

-- http://timboudreau.com

chhh commented 5 years ago

Restarted the computer, didn't help. And that's definitely not a sorting issue, I only see like 4 RELEASE versions in the menu there. But I know what you mean, I've see the "broken" sorting when using some other NB IDE 11.x version.

Excuse/disclosure: I'm just trying to return to NB Platform development, so quite rusty. I only had 1 project built with it in the first place (http://batmass.org/#some-examples). Previously I used ant builds with platform+harness pre-downloaded from netbeans website and every library dependency was wrapped into a Lib Module. Which drove me nuts and forced to abandon the project. I'd want to rewrite it and restart the development using the updated new platform. But only using Maven (can't take the pain of wrapped libs) and only if I have control and at least some understanding of the underlying "platform", i.e. I can compile it myself, fix issues myself (and push them to upstream!) and use my self-built "platform" to build a Netbeans Platform app using Maven.

I created a new "Platorm with Maven" app through the IDE and included one module that only had a layer.xml that deleted a few main menu entries. I did rummage through all the files that were created for me by the IDE, and only found one place to change a reference to the platform used in the form of a property in mavenproject8-parent "parent" project pom, where I changed the reference to:

<properties>
    <netbeans.version>RELEASE123</netbeans.version>
    <brandingToken>mavenproject8</brandingToken>
</properties>

After that the project did actually build, but there were errors in tests (and the same errors present themselves when I try starting the app, and the app can't load some modules):

-------------------------------------------------------------------------------
Test set: com.mycompany.mavenproject8.ApplicationTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.371 sec <<< FAILURE!
testApplication(com.mycompany.mavenproject8.ApplicationTest)  Time elapsed: 0.007 sec  <<< FAILURE!
junit.framework.AssertionFailedError: NbModuleSuite has been started with failOnMessage(WARNING) and failOnException(INFO). The following failures have been captured:
[org.netbeans.core.startup.NbEvents] THREAD: main MSG: Warning - could not install some modules:
    mavenproject8-branding - The module Common Annotations was requested in version >= 1.33 but only 1.31.1 was found.
    mavenproject8-sample - The module UI Utilities API was requested in version >= 7.74 but only 7.72.1 was found.
    mavenproject8-sample - The module Base Utilities API was requested in version >= 9.13 but only 9.11.1 was found.
    mavenproject8-sample - The module Common Annotations was requested in version >= 1.33 but only 1.31.1 was found.

But this makes no sense as I built from the tip of master on apache-netbeans-github.

timboudreau commented 5 years ago

Does the section of the nbm-maven-plugin spell out specific plugin versions? It can optionally do that, though I don't think the IDE generates that by default - but those versions (actual specification versions from module manifests) are what the platform actually reads on startup, not the "RELEASEnnn" stuff generated for Maven.

Alternatively, are you trying to load it in an older NetBeans version that you are running? That would definitely do it. It should load fine if you use the build of NetBeans under $NB_SRC/nbbuild/netbeans which will have the same versions as what you built. If you try to load it in an older platform, it will complain (you could use that same detailed version info to make your module runtime-compatible with older versions, but it means entering the specification version for everything (I wrote some tooling to find modules in the local repo and extract this from their manifest, for Mavenizing NetBeans projects, but it's not something that currently can work on an existing project) - here's an example of what that looks like: https://github.com/timboudreau/netbeans-contrib/blob/master/ada.editor/pom.xml

chhh commented 5 years ago

@timboudreau Sorry, was traveling, couldn't check this. Now looking at the generated project and answering the questions:

A minimal example is here: https://github.com/chhh/nb-platform-with-maven-01
You can create one yourself in 10 seconds using the wizard of the new NB IDE 11.2 File -> New Project -> Java with Maven -> NetBeans Application, Next, Next, try switching Netbeans Version dropdown (for me it shows versions RELEASE90 [also 100,110,111] and dev-SNAPSHOT. But not mine RELEASE123 which is in the local maven repo. So I naively tried changing that only maven property that I've found linking to the RELEASE110, which didn't work.