Reloading of resources with NetBeans IDE
Requirements
For this setup I used
- NetBeans 5.5
, but it will work with 5.0.
- Web Project, with Java Blueprints as the source structure (require some tweak if the source structure is different)
- Registered Tomcat server at Server Manager
Configure dynamic reloading on the context
Append the attribute reloadable="true" on the Context element.
This will enable dynamic reloading
for WEB-INF/classes and WEB-INF/lib. Be careful, this will reload the entire context.
<Context ... reloadable="true" />
Hit F9 (compile single class) or F11 (build package) and refresh the browser
Reload templates and RIFE elements
For this to work, the src/conf directory needed to be copied to build/web/WEB-INF/classes, which is the directory that tomcat uses as the docBase.
Insert the following xml code to the build.xml
<target name="-post-dist">
<copy todir="${build.classes.dir}">
<fileset dir="${conf.dir}" includes="*" excludesfile="${conf.dir}/MANIFEST.MF" />
</copy>
</target>
Press F11, to build the application. In detail, it will invoke the dist ant target.
Don't worry about the ant variables, because the ant build system will read the variables at nbproject/project.properties
I know that is possible to enable dynamic reloading without the servlet container, RIFE takes care. For the moment I didn't get it. You can see how to [enable it for IDEA and Eclipse]
.
Feel free to change this page or leave a comment, on how to improve this tip.