Hi,

I see no reason to compile the entire ANB when you need to change one class:

Java Hacker's guide ;)

Jar is a plain zip file and nothing prevents us from replacing any class with our version. Assuming that we preserve the original definition of methods and Inheritances.
We can change the body of methods without any problem.
Of course, you can also add a new method and additionally implement any interface in classpath.

If the patched library is available as maven artifact create a maven project and add that library as a dependency. Otherwise, we will use the Ant project and we manually add that library and necessary dependencies.
Be sure to set the correct Java target level in the project..
Now we will create a package and a class that we want to patch.
After making the necessary adjustments, we will compile the project.
And in the ../target/classes directory, our patched classes are waiting for us.


You can find the Maven project with your patch here:
https://github.com/arsi-apli/ModulePatchExample


Now we just have to add / overwrite the original classes with ours in the jar.

Download the ANB 11 distribution zip and unpack it somewhere. Goto ./netbeans/platform/modules/ and add the generated classes to org-netbeans-modules-autoupdate-ui.jar to correct package/folder


If you are developing the NB modules via ant, just add that unpacked ANB dist directory as the NB platform. For maven it is necessary to modify original maven artifact jar file and  publish this jar as new maven artifact version (locally) and use it as dependency. And when you pack that unpacked distribution directory, you have a patched distribution..


I used this procedure to port Android tools libraries to support java > 8 in NBANDROID...


ArSi
------------------------------------------------------------------------
*From:* Joseph Huber <jhu...@stanref.com>
*Sent:* Wednesday, May 08, 2019 11:56PM
*To:* Arsi <a...@chello.sk>, Users <users@netbeans.apache.org>
*Subject:* RE: Trouble patching NetBeans 11.0 platform module

Hello!

I have a solution that works quite well in Netbeans 8.2. I believe that the question is whether or not this approach should still work with NetBeans 11.0.  If it should, then I would like to find out why it isn’t working.  If the approach described at http://wiki.netbeans.org/DevFaqOrphanedNetBeansOrgModules is no longer valid for NetBeans 11.0, then so be it, and I will move to a different approach.

In the bigger picture, it would probably be helpful for others in the community using the method in the aforementioned FAQ to know whether the method is still valid for 11.0.

I don’t know if my platform patch is useful for others.  There didn’t seem to be much interest when it was being discussed on forums.netbeans.org back in 2016.

Thank You!

Joe Huber

Standard Refrigeration LLC

2005 Reverchon Dr

Arlington, TX  76017

Cell: 682-777-8374

jhu...@stanref.com

*From:*arsi <a...@chello.sk>
*Sent:* Wednesday, May 8, 2019 4:47 PM
*To:* users@netbeans.apache.org
*Subject:* Re: Trouble patching NetBeans 11.0 platform module

Hi,

If you only want a private patch, you can do a patch module:

http://wiki.netbeans.org/DevFaqModulePatching

Maven example:

https://github.com/NBANDROIDTEAM/org-netbeans-modules-masterfs-patches

ArSi

------------------------------------------------------------------------

*From:* Joseph Huber <jhu...@stanref.com> <mailto:jhu...@stanref.com>
*Sent:* Wednesday, May 08, 2019 11:30PM
*To:* Geertjan Wielenga <geert...@apache.org> <mailto:geert...@apache.org>
*Cc:* Users <users@netbeans.apache.org> <mailto:users@netbeans.apache.org>
*Subject:* RE: Trouble patching NetBeans 11.0 platform module

    My patch is described here:

    
http://netbeans-org.1045718.n5.nabble.com/Update-Center-issue-How-to-hide-remove-items-from-the-Available-Plugins-tab-td5749157.html#a5749162

    As for patching the zip, I am familiar with that process, and I am
    not familiar with the GitHub/pull request process.   Patching the
    zip previously worked fine.

    Thank You!

    Joe Huber

    Standard Refrigeration LLC

    2005 Reverchon Dr

    Arlington, TX  76017

    Cell: 682-777-8374

    jhu...@stanref.com <mailto:jhu...@stanref.com>

    *From:*Geertjan Wielenga <geert...@apache.org>
    <mailto:geert...@apache.org>
    *Sent:* Wednesday, May 8, 2019 4:03 PM
    *To:* Joseph Huber <jhu...@stanref.com> <mailto:jhu...@stanref.com>
    *Cc:* users@netbeans.apache.org <mailto:users@netbeans.apache.org>
    *Subject:* Re: Trouble patching NetBeans 11.0 platform module

    I believe they should be downloaded during the build process.

    But rather than patching via the ZIP, why not clone the GitHub
    repo and then provide a pull request there?

    What does your patch do?

    Gj

    On Wed, 8 May 2019 at 22:34, Joseph Huber <jhu...@stanref.com
    <mailto:jhu...@stanref.com>> wrote:

        Hello!

        I am in the initial phase of trying to patch a NetBeans 11.0
        platform module (which I have successfully done in NetBeans
        8.2) per the procedure at
        http://wiki.netbeans.org/DevFaqOrphanedNetBeansOrgModules.  I
        downloaded the 11.0 source from the links at

        
https://www.apache.org/dyn/closer.cgi/incubator/netbeans/incubating-netbeans/incubating-11.0/incubating-netbeans-11.0-source.zip


        The process is crashing at the “ant -f nbbuild/build.xml
        bootstrap” step with numerous errors regarding javax.help,
        such as:

        nb_all\nbbuild\antsrc\org\netbeans\nbbuild\CheckHelpSets.java:37:
        error: package javax.help does not exist

        In the netbeans 8.2 platform source, javahelp\external
        contains the following files: binaries-list, jhall-2.0_05.jar,
        jhall-2.0_05-license.txt

        In the netbeans 11.0 platform source, javahelp\external
        contains the following files: binaries-list, 
        jhall-2.0_05-license.txt

        jhall-2.0_05.jar is missing in 11.0, which I believe is the
        source of the above error.  The 11.0 binaries-list file
        contains the following text:

        # Licensed to the Apache Software Foundation (ASF) under one

        # or more contributor license agreements.  See the NOTICE file

        # distributed with this work for additional information

        # regarding copyright ownership.  The ASF licenses this file

        # to you under the Apache License, Version 2.0 (the

        # "License"); you may not use this file except in compliance

        # with the License.  You may obtain a copy of the License at

        #

        # http://www.apache.org/licenses/LICENSE-2.0

        #

        # Unless required by applicable law or agreed to in writing,

        # software distributed under the License is distributed on an

        # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

        # KIND, either express or implied.  See the License for the

        # specific language governing permissions and limitations

        # under the License.

        CA70822C47A67FC3A11670270567C2D01566DAE1 jhall-2.0_05.jar

        It seems that jhall-2.0_05.jar should be in the 11.0,
        javahelp\external folder (like it is in 8.2), but it is
        missing.  Is this a bug?  I searched through the 11.0 source,
        and I don’t find jhall-2.0_05.jar included.

        Thank You for any help!

        Joe Huber

        Standard Refrigeration LLC

        2005 Reverchon Dr
        
<https://maps.google.com/?q=2005+Reverchon+Dr+%0D%0A+Arlington,+TX+76017&entry=gmail&source=g>

        Arlington, TX
        
<https://maps.google.com/?q=2005+Reverchon+Dr+%0D%0A+Arlington,+TX+76017&entry=gmail&source=g>
        76017
        
<https://maps.google.com/?q=2005+Reverchon+Dr+%0D%0A+Arlington,+TX+76017&entry=gmail&source=g>

        Cell: 682-777-8374

        jhu...@stanref.co <mailto:jhu...@stanref.co>











Reply via email to