Bundling a JVM for a mavenized project

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Bundling a JVM for a mavenized project

William Winder
I'm trying to bundle a JVM for a mavenized netbeans platform project.

I've found lots of documentation for configuring the ant scripts, and although there are a lot of steps it doesn't seem very complicated to configure:

There is also a lot of detail about configuring the NBI using nbm-maven-plugin properties here (mainly the ConfigurationLogic.java file):

But I don't see any option for configuring the value of "nbi.bundled.jvm.file" which seems to be the missing piece. There is a template.xml file which I'm hoping can somehow bridge the gap between the ant and maven builds, but I'm not clear about how.

Any guidance would be appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: Bundling a JVM for a mavenized project

Peter Hansson-2
I use my own customized version of the recipe from the DZone article
that you reference.
... and I use Maven.

Yes, this is somewhat complicated. The problem is that even if you are
using Maven it will still be the Ant build scripts from the harness
which will be executed when installers are being build. The
nbm-maven-plugin will ultimately simply call Ant script. So you need a
bit of Ant knowledge.

What you can do in nbm-maven-plugin is set the name of the  'template
file' ( <templateFile>foo/bar/template.xml</templateFile>) which is
really just the starting point of those Ant scripts. Anyway, I copy
the Ant scripts and all their associated stuff (what is known as 'the
harness') from an IDE distro into my installer project's src dir. Then
I have a copy I can customize. Then I let my template file variable in
nbm-maven-plugin point to a template.xml file I have in project's
'src' dir, rather than something in the IDE's install directory.

See http://www.mojohaus.org/nbm-maven-plugin/build-installers-mojo.html#templateFile

How exactly you choose to customize the harness (or rather your
private copy of that) depends entirely on your specific requirements.

/Peter

PS: Bundling of a JRE for the Mac OSX platform hasn't worked in the
past but has now been fixed (see
https://netbeans.org/bugzilla/show_bug.cgi?id=250103), however it is
not in NB 8.2. Will be in next release of if you use a dev release.


On Mon, Sep 11, 2017 at 2:24 AM, William Winder <[hidden email]> wrote:

> I'm trying to bundle a JVM for a mavenized netbeans platform project.
>
> I've found lots of documentation for configuring the ant scripts, and
> although there are a lot of steps it doesn't seem very complicated to
> configure:
> http://wiki.netbeans.org/NBIBundledJVM
> https://dzone.com/articles/including-jre-in-nbi
> https://blogs.oracle.com/geertjan/installing-the-jre-via-an-applications-installer-via-windows
> https://platform.netbeans.org/tutorials/nbm-nbi.html#bundling-jre
>
> There is also a lot of detail about configuring the NBI using
> nbm-maven-plugin properties here (mainly the ConfigurationLogic.java file):
> http://www.mojohaus.org/nbm-maven-plugin/buildinstexample.html
>
> But I don't see any option for configuring the value of
> "nbi.bundled.jvm.file" which seems to be the missing piece. There is a
> template.xml file which I'm hoping can somehow bridge the gap between the
> ant and maven builds, but I'm not clear about how.
>
> Any guidance would be appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: Bundling a JVM for a mavenized project

William Winder
Thanks Peter, it's reassuring to know that it's possible.

If you give me one more hint, how do I override the "-generate-bundles" target and <create-bundle> calls? It isn't present in the template.xml file. Once I get over that hurdle I can customize things according to my requirements, and I'll likely create a document for the knowledge base that others can use for hints in the future.

On Mon, Sep 11, 2017 at 12:59 PM, Peter Hansson <[hidden email]> wrote:
I use my own customized version of the recipe from the DZone article
that you reference.
... and I use Maven.

Yes, this is somewhat complicated. The problem is that even if you are
using Maven it will still be the Ant build scripts from the harness
which will be executed when installers are being build. The
nbm-maven-plugin will ultimately simply call Ant script. So you need a
bit of Ant knowledge.

What you can do in nbm-maven-plugin is set the name of the  'template
file' ( <templateFile>foo/bar/template.xml</templateFile>) which is
really just the starting point of those Ant scripts. Anyway, I copy
the Ant scripts and all their associated stuff (what is known as 'the
harness') from an IDE distro into my installer project's src dir. Then
I have a copy I can customize. Then I let my template file variable in
nbm-maven-plugin point to a template.xml file I have in project's
'src' dir, rather than something in the IDE's install directory.

See http://www.mojohaus.org/nbm-maven-plugin/build-installers-mojo.html#templateFile

How exactly you choose to customize the harness (or rather your
private copy of that) depends entirely on your specific requirements.

/Peter

PS: Bundling of a JRE for the Mac OSX platform hasn't worked in the
past but has now been fixed (see
https://netbeans.org/bugzilla/show_bug.cgi?id=250103), however it is
not in NB 8.2. Will be in next release of if you use a dev release.


On Mon, Sep 11, 2017 at 2:24 AM, William Winder <[hidden email]> wrote:
> I'm trying to bundle a JVM for a mavenized netbeans platform project.
>
> I've found lots of documentation for configuring the ant scripts, and
> although there are a lot of steps it doesn't seem very complicated to
> configure:
> http://wiki.netbeans.org/NBIBundledJVM
> https://dzone.com/articles/including-jre-in-nbi
> https://blogs.oracle.com/geertjan/installing-the-jre-via-an-applications-installer-via-windows
> https://platform.netbeans.org/tutorials/nbm-nbi.html#bundling-jre
>
> There is also a lot of detail about configuring the NBI using
> nbm-maven-plugin properties here (mainly the ConfigurationLogic.java file):
> http://www.mojohaus.org/nbm-maven-plugin/buildinstexample.html
>
> But I don't see any option for configuring the value of
> "nbi.bundled.jvm.file" which seems to be the missing piece. There is a
> template.xml file which I'm hoping can somehow bridge the gap between the
> ant and maven builds, but I'm not clear about how.
>
> Any guidance would be appreciated.

Reply | Threaded
Open this post in threaded view
|

Re: Bundling a JVM for a mavenized project

Peter Hansson-2
It is in file build.xml which is in same directory as file
template.xml. That directory is harness/nbi/stub. Anyway, you need to
customize build.xml file.

template.xml will ultimately invoke build.xml.

On Tue, Sep 12, 2017 at 3:22 PM, William Winder <[hidden email]> wrote:

> Thanks Peter, it's reassuring to know that it's possible.
>
> If you give me one more hint, how do I override the "-generate-bundles"
> target and <create-bundle> calls? It isn't present in the template.xml file.
> Once I get over that hurdle I can customize things according to my
> requirements, and I'll likely create a document for the knowledge base that
> others can use for hints in the future.
>
> On Mon, Sep 11, 2017 at 12:59 PM, Peter Hansson
> <[hidden email]> wrote:
>>
>> I use my own customized version of the recipe from the DZone article
>> that you reference.
>> ... and I use Maven.
>>
>> Yes, this is somewhat complicated. The problem is that even if you are
>> using Maven it will still be the Ant build scripts from the harness
>> which will be executed when installers are being build. The
>> nbm-maven-plugin will ultimately simply call Ant script. So you need a
>> bit of Ant knowledge.
>>
>> What you can do in nbm-maven-plugin is set the name of the  'template
>> file' ( <templateFile>foo/bar/template.xml</templateFile>) which is
>> really just the starting point of those Ant scripts. Anyway, I copy
>> the Ant scripts and all their associated stuff (what is known as 'the
>> harness') from an IDE distro into my installer project's src dir. Then
>> I have a copy I can customize. Then I let my template file variable in
>> nbm-maven-plugin point to a template.xml file I have in project's
>> 'src' dir, rather than something in the IDE's install directory.
>>
>> See
>> http://www.mojohaus.org/nbm-maven-plugin/build-installers-mojo.html#templateFile
>>
>> How exactly you choose to customize the harness (or rather your
>> private copy of that) depends entirely on your specific requirements.
>>
>> /Peter
>>
>> PS: Bundling of a JRE for the Mac OSX platform hasn't worked in the
>> past but has now been fixed (see
>> https://netbeans.org/bugzilla/show_bug.cgi?id=250103), however it is
>> not in NB 8.2. Will be in next release of if you use a dev release.
>>
>>
>> On Mon, Sep 11, 2017 at 2:24 AM, William Winder <[hidden email]>
>> wrote:
>> > I'm trying to bundle a JVM for a mavenized netbeans platform project.
>> >
>> > I've found lots of documentation for configuring the ant scripts, and
>> > although there are a lot of steps it doesn't seem very complicated to
>> > configure:
>> > http://wiki.netbeans.org/NBIBundledJVM
>> > https://dzone.com/articles/including-jre-in-nbi
>> >
>> > https://blogs.oracle.com/geertjan/installing-the-jre-via-an-applications-installer-via-windows
>> > https://platform.netbeans.org/tutorials/nbm-nbi.html#bundling-jre
>> >
>> > There is also a lot of detail about configuring the NBI using
>> > nbm-maven-plugin properties here (mainly the ConfigurationLogic.java
>> > file):
>> > http://www.mojohaus.org/nbm-maven-plugin/buildinstexample.html
>> >
>> > But I don't see any option for configuring the value of
>> > "nbi.bundled.jvm.file" which seems to be the missing piece. There is a
>> > template.xml file which I'm hoping can somehow bridge the gap between
>> > the
>> > ant and maven builds, but I'm not clear about how.
>> >
>> > Any guidance would be appreciated.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Bundling a JVM for a mavenized project

William Winder
Thank you Peter! I missed the important step in your first email where you have a copy of the harness in your project. I found the "${nbi.stub.location}" setting in the template.xml, so I will try updating that to point to a local copy of the harness.

On Wed, Sep 13, 2017 at 6:35 AM, Peter Hansson <[hidden email]> wrote:
It is in file build.xml which is in same directory as file
template.xml. That directory is harness/nbi/stub. Anyway, you need to
customize build.xml file.

template.xml will ultimately invoke build.xml.

On Tue, Sep 12, 2017 at 3:22 PM, William Winder <[hidden email]> wrote:
> Thanks Peter, it's reassuring to know that it's possible.
>
> If you give me one more hint, how do I override the "-generate-bundles"
> target and <create-bundle> calls? It isn't present in the template.xml file.
> Once I get over that hurdle I can customize things according to my
> requirements, and I'll likely create a document for the knowledge base that
> others can use for hints in the future.
>
> On Mon, Sep 11, 2017 at 12:59 PM, Peter Hansson
> <[hidden email]> wrote:
>>
>> I use my own customized version of the recipe from the DZone article
>> that you reference.
>> ... and I use Maven.
>>
>> Yes, this is somewhat complicated. The problem is that even if you are
>> using Maven it will still be the Ant build scripts from the harness
>> which will be executed when installers are being build. The
>> nbm-maven-plugin will ultimately simply call Ant script. So you need a
>> bit of Ant knowledge.
>>
>> What you can do in nbm-maven-plugin is set the name of the  'template
>> file' ( <templateFile>foo/bar/template.xml</templateFile>) which is
>> really just the starting point of those Ant scripts. Anyway, I copy
>> the Ant scripts and all their associated stuff (what is known as 'the
>> harness') from an IDE distro into my installer project's src dir. Then
>> I have a copy I can customize. Then I let my template file variable in
>> nbm-maven-plugin point to a template.xml file I have in project's
>> 'src' dir, rather than something in the IDE's install directory.
>>
>> See
>> http://www.mojohaus.org/nbm-maven-plugin/build-installers-mojo.html#templateFile
>>
>> How exactly you choose to customize the harness (or rather your
>> private copy of that) depends entirely on your specific requirements.
>>
>> /Peter
>>
>> PS: Bundling of a JRE for the Mac OSX platform hasn't worked in the
>> past but has now been fixed (see
>> https://netbeans.org/bugzilla/show_bug.cgi?id=250103), however it is
>> not in NB 8.2. Will be in next release of if you use a dev release.
>>
>>
>> On Mon, Sep 11, 2017 at 2:24 AM, William Winder <[hidden email]>
>> wrote:
>> > I'm trying to bundle a JVM for a mavenized netbeans platform project.
>> >
>> > I've found lots of documentation for configuring the ant scripts, and
>> > although there are a lot of steps it doesn't seem very complicated to
>> > configure:
>> > http://wiki.netbeans.org/NBIBundledJVM
>> > https://dzone.com/articles/including-jre-in-nbi
>> >
>> > https://blogs.oracle.com/geertjan/installing-the-jre-via-an-applications-installer-via-windows
>> > https://platform.netbeans.org/tutorials/nbm-nbi.html#bundling-jre
>> >
>> > There is also a lot of detail about configuring the NBI using
>> > nbm-maven-plugin properties here (mainly the ConfigurationLogic.java
>> > file):
>> > http://www.mojohaus.org/nbm-maven-plugin/buildinstexample.html
>> >
>> > But I don't see any option for configuring the value of
>> > "nbi.bundled.jvm.file" which seems to be the missing piece. There is a
>> > template.xml file which I'm hoping can somehow bridge the gap between
>> > the
>> > ant and maven builds, but I'm not clear about how.
>> >
>> > Any guidance would be appreciated.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Bundling a JVM for a mavenized project

Peter Hansson-2
Yeah, working with a project-private copy of the harness is really the
way to go. It is however NOT what you can read in the recipes you can
find online. What you can find online will recommend you to change the
harness in the NetBeans installation directory. Don't do it, don't
touch it. This is obviously incredibly stupid to do as it will make
the build dependent on something on YOUR workstation. Ouch.

The only downside to having a project-private copy of the harness that
you then customize is that you won't get the benefit of new features
or bug fixes to the harness. Once you've made the copy it is static.
But you won't be missing out on much. Nobody has made changes / bug
fixes to the NB harness in years.  :-)

(hopefully because it just works!)



On Wed, Sep 13, 2017 at 4:20 PM, William Winder <[hidden email]> wrote:

> Thank you Peter! I missed the important step in your first email where you
> have a copy of the harness in your project. I found the
> "${nbi.stub.location}" setting in the template.xml, so I will try updating
> that to point to a local copy of the harness.
>
> On Wed, Sep 13, 2017 at 6:35 AM, Peter Hansson <[hidden email]>
> wrote:
>>
>> It is in file build.xml which is in same directory as file
>> template.xml. That directory is harness/nbi/stub. Anyway, you need to
>> customize build.xml file.
>>
>> template.xml will ultimately invoke build.xml.
>>
>> On Tue, Sep 12, 2017 at 3:22 PM, William Winder <[hidden email]>
>> wrote:
>> > Thanks Peter, it's reassuring to know that it's possible.
>> >
>> > If you give me one more hint, how do I override the "-generate-bundles"
>> > target and <create-bundle> calls? It isn't present in the template.xml
>> > file.
>> > Once I get over that hurdle I can customize things according to my
>> > requirements, and I'll likely create a document for the knowledge base
>> > that
>> > others can use for hints in the future.
>> >
>> > On Mon, Sep 11, 2017 at 12:59 PM, Peter Hansson
>> > <[hidden email]> wrote:
>> >>
>> >> I use my own customized version of the recipe from the DZone article
>> >> that you reference.
>> >> ... and I use Maven.
>> >>
>> >> Yes, this is somewhat complicated. The problem is that even if you are
>> >> using Maven it will still be the Ant build scripts from the harness
>> >> which will be executed when installers are being build. The
>> >> nbm-maven-plugin will ultimately simply call Ant script. So you need a
>> >> bit of Ant knowledge.
>> >>
>> >> What you can do in nbm-maven-plugin is set the name of the  'template
>> >> file' ( <templateFile>foo/bar/template.xml</templateFile>) which is
>> >> really just the starting point of those Ant scripts. Anyway, I copy
>> >> the Ant scripts and all their associated stuff (what is known as 'the
>> >> harness') from an IDE distro into my installer project's src dir. Then
>> >> I have a copy I can customize. Then I let my template file variable in
>> >> nbm-maven-plugin point to a template.xml file I have in project's
>> >> 'src' dir, rather than something in the IDE's install directory.
>> >>
>> >> See
>> >>
>> >> http://www.mojohaus.org/nbm-maven-plugin/build-installers-mojo.html#templateFile
>> >>
>> >> How exactly you choose to customize the harness (or rather your
>> >> private copy of that) depends entirely on your specific requirements.
>> >>
>> >> /Peter
>> >>
>> >> PS: Bundling of a JRE for the Mac OSX platform hasn't worked in the
>> >> past but has now been fixed (see
>> >> https://netbeans.org/bugzilla/show_bug.cgi?id=250103), however it is
>> >> not in NB 8.2. Will be in next release of if you use a dev release.
>> >>
>> >>
>> >> On Mon, Sep 11, 2017 at 2:24 AM, William Winder <[hidden email]>
>> >> wrote:
>> >> > I'm trying to bundle a JVM for a mavenized netbeans platform project.
>> >> >
>> >> > I've found lots of documentation for configuring the ant scripts, and
>> >> > although there are a lot of steps it doesn't seem very complicated to
>> >> > configure:
>> >> > http://wiki.netbeans.org/NBIBundledJVM
>> >> > https://dzone.com/articles/including-jre-in-nbi
>> >> >
>> >> >
>> >> > https://blogs.oracle.com/geertjan/installing-the-jre-via-an-applications-installer-via-windows
>> >> > https://platform.netbeans.org/tutorials/nbm-nbi.html#bundling-jre
>> >> >
>> >> > There is also a lot of detail about configuring the NBI using
>> >> > nbm-maven-plugin properties here (mainly the ConfigurationLogic.java
>> >> > file):
>> >> > http://www.mojohaus.org/nbm-maven-plugin/buildinstexample.html
>> >> >
>> >> > But I don't see any option for configuring the value of
>> >> > "nbi.bundled.jvm.file" which seems to be the missing piece. There is
>> >> > a
>> >> > template.xml file which I'm hoping can somehow bridge the gap between
>> >> > the
>> >> > ant and maven builds, but I'm not clear about how.
>> >> >
>> >> > Any guidance would be appreciated.
>> >
>> >
>
>