Hot deploying changes with Netbeans, Maven, and Glassfish
Asked Answered
M

2

8

Recently we migrated from using ant to maven. Within Netbeans, I used to edit and save html, xhtml, javascript, css files in the WAR and almost immediately the changes were available on the server.

Now, when I edit and save those types of files in the WAR, nothing happens. I have to right click my EAR -> Build with dependencies -> Run to make the changes available. This process takes ages.

I've found a few similar questions, but am still confused.

EDIT: I just wiped my development environment and setup from scratch again. Then I duplicated the setup on a co-worker's machine (him on Windows, me on Ubuntu). With the same setup process, less different OSs, he can edit/save xhtml files and see the changes without additional steps!

Mckenzie answered 18/2, 2010 at 18:1 Comment(2)
I need the same for tomcat, any idea ?Wymore
I have the exact same nightmare... except I reinstalled my own OS (yearly clean out), set up my machine as identically as possible, and have now lost the ability to change JS files without doing a compile/deploy. Cant find any info on this...Spendable
A
3

To enable hot-deploy, enable the "Compile on Save" feature in Netbeans. In your POM, add this property:

<netbeans.compile.on.save>all</netbeans.compile.on.save>

This property will be inherited, so if you have a parent project, you may consider putting it there.

Note that there is a bug in which the change is not reflected in the UI, so it will look like the property has no effect, but you'll notice that hot-deploy works.

Arnaud answered 10/8, 2011 at 8:25 Comment(0)
S
1

Not really a good idea... but I may have done it for rapid development as well. Shh! Use maven's exec plugin to do it. From my pom:

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.1</version>
            <executions>
                <execution>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <executable>asadmin</executable>
                <arguments>
                    <argument>deploy</argument>
                    <argument>${project.build.directory}/${project.build.finalName}</argument>
                </arguments>
            </configuration>
        </plugin>

EDIT: Assuming asadmin (which is a glassfish command) can be found.

Springtail answered 18/2, 2010 at 18:4 Comment(1)
I need the same for tomcat, any idea ?Wymore

© 2022 - 2024 — McMap. All rights reserved.