Can I use JRebel to speed up development?

Apache NetBeans Wiki Index

Note: These pages are being reviewed.

Yes, you can. Once you have obtained JRebel and installed it locally, paste the following snippet into your application’s root pom (parent of both the NetBeans application project and any NetBeans module projects you want to have reloaded upon change).

        <profile>
            <id>rebel</id>
            <activation>
                <file>
                    <exists>/Users/mkleint/jrebel/jrebel.jar</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.zeroturnaround</groupId>
                        <artifactId>jrebel-maven-plugin</artifactId>
                        <version>1.1.1</version>
                        <executions>
                            <execution>
                                <id>generate-rebel-xml</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>generate</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>

                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>nbm-maven-plugin</artifactId>
                            <configuration>
                                <!-- only works if additionalArguments not defined in the application's pom -->
                                <additionalArguments>-J-javaagent:/Users/mkleint/jrebel/jrebel.jar=org.netbeans.JarClassLoader,org.netbeans.StandardModule.OneModuleClassLoader</additionalArguments>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
            <properties>
                <netbeans.compile.on.save>app</netbeans.compile.on.save>
            </properties>
        </profile>

You will have to edit the path to your jrebel.jar you have locally. if multiple people are going to work on the project use an expression and define the path property in your settings.xml file.

Please note that any layer or manifest registrations are not likely to be reloaded as JRebel doesn’t have any special knowledge about NetBeans internals.

The solution was tested with nbm-maven-plugin 3.8 and JRebel 5.0.1