Some more tips about getting an AppFuse generated application into NetBeans.
- Pick archetype of choice, e.g.: mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring -DremoteRepositories=http://static.appfuse.org/releases -DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject
- Run mvn
- Generate full sources: mvn appfuse:full-source
- Install the Maven plugin in NetBeans (Tools / Plugins / Search for Maven).
- Open the project (located the pom.xml file)
- Right-click the project name and select Properties
- In categories, select Run. Chose a server.
- In categories, select Actions. Check the box for Use external Maven for build execution.
- In main window, select Tools / Options / Miscellaneous / Maven 2.
- Now Run the project, and after a while a browser should open pointing you to the login screen.
Sometime it may be useful to manually run the (Canoo) web tests for AppFuse applications to be able to see what goes wrong. Accomplish this by making the test web container pause upon start using:
Then the application (using default values) is reachable at:
Where <app_name> might be something like appname-1.0-SNAPSHOT depending on your configuration.
If a test fails it might also be a good idea to take a look at how the pages retrieved actually look like, they are saved (by default) in the directory target\webtest-data.
Once mapped in hibernate.cfg.xml run:
mvn test-compile hibernate3:hbm2ddl
To skip tests when running/compiling using AppFuse projects, set the maven.test.skip property:
mvn jetty:run-war -Dmaven.test.skip=true
Opening an AppFuse in NetBeans might be done in two ways, two ways that I managed to mix up the first time…
Either install the Maven plugin Mevenide2 for NetBeans, then you may simply open the Maven project generated by AppFuse directly. Without the Maven plugin, then you need to convert to project using mvn netbeans:netbeans (see previous post). Opening up a converted project with the NetBeans Maven plugin installed will result in badness.
Wondering where the source is? See this post.
In AppFuse 2.x you don’t automatically get the full source of the generated project. To generate the source, run:
On my Ubuntubox this all went well, but on my work laptop running Windows XP it failed with the fatal error:
Illegal character in path at index 18: file:/C:/Documents and Settings/myuser/.m2/repository/org/apache/ant/ant/1.7.0/ant-1.7.0.jar
Turned out to be because of the spaces in the path, a not so uncommon problem for *nix stuff running under Windows.
To solve this you may either move your maven artifact repository to a path without a space, or edit the maven settings.xml so the path no longer includes a space. This is achieved by using DOS short names. To see what a files short name is, open the command prompt and run dir /X.
The settings.xml is likely located in the conf directory where you installed Apache Maven, in my case it was:
C:\Program Files\Apache Software Foundation\apache-maven-2.0.9\conf\settings.xml
I added an entry (if there is already one, edit it) for localRepository:
Now everything worked and I got BUILD SUCCESSFUL. Please note that the actual path is likely different on your setup. Change it as appropriate.
Using mvn netbeans:netbeans to generate a NetBeans project from AppFuse failed with the following build error:
The plugin ‘org.apache.maven.plugins:maven-netbeans-plugin’ does not exist or no valid version could be found
Apprently it cannot find the netbeans plugin. To fix this, open the pom.xml of the project and add a new plugin repository:
... keep the existing one ...