I just want a basic Junit that that will test loading the configuration file struts.xml and making sure all the classes can be found and such.
I'm using the struts junit 2.2.1 plugin.
I recommend you to use the Config Browser Plugin of Struts2.
Description :
The Config Browser Plugin is a simple tool to help view an application's configuration at runtime. It is very useful when debugging problems that could be related to configuration issues.
Related
If I'm looking at project source code (in Intellij) how can I tell whether the Grails source code I'm looking at is an Application or a Plugin?
I get it that the output of a Grails Application build is a WAR, and a JAR for a Plugin but I can't figure out how to tell the difference by looking at the source code.
Bonus question: If it is a multi-module project, how do I tell which module is the Application and which modules are the Plugins? Or am I missing some important concept here?
Plugins can be run as applications as well and will often have an Application.groovy file. Plugins will have a <pluginname>GrailsPlugin.groovy file which sets up the plugin. In grails 3, this is in /src/main/groovy file structure.
I am new to grails and have created my first project using grails-init. I now have a grails project that uses gradle as it's build tool. However, as I go through online tutorials I find that I am missing a lot of the files that are commonly cited. Files such as config.groovy and datasource.groovy.
I've tried re-creating the project, but I get the same structure and files. Can I just add these files manually? I have tried doing so, but they don't seem to be getting picked up when I run the application.
Config.groovy and DataSource.groovy are both applicable to Grails 2 applications but not Grails 3 applications. In Grails 3 the default place for the information that used to go in those files is application.yml.
Grails 3.1 have new features and structure changes. Now grails uses spring boot and Spring 4.2 and as mentioned, Config.groovy and Datasource.groovy can be configured using application.yml. You can found more information here Grails documentation
I tried configuring my Maven build with hibernate Validator So that I can validate my named queries during Buil rather during the launch of the application. Can any one help me with this.
I suggest follow the link here to get started
http://hibernate.org/validator/documentation/getting-started/
Add dependency to your pom.xml
org.hibernate
hibernate-validator
5.2.2.Final
if the application is not run in any application server, you'd better add an implementation of the Unified Expression Language
javax.el
javax.el-api
2.2.4
org.glassfish.web
javax.el
2.2.4
Run unit test to verify before launch application
I've created a custom Grails plugin, and this plugin needs two other war files to work fine. Can someone tell me how to make that plugin depends on those war files ?
What should I put in the BuildConfig.groovy ?
Thanx all.
If i get you question, what you need is something to build the app, the plugins and war all together. You could use Maven, Gradle or Gant.
Here is a similar question: How to set up a multiproject Grails using Gradle?
Does PMD works with grails project, i.e. with .groovy files??
i'm using STS editor,
if it works, what setup i have to do?
Please let me know, if anyone have any idea
Thanks in advance
I'm not aware of any PMD plugin for Groovy/Grails. However, there is a CodeNarc Grails plugin, which does similar kinds of static analysis on Groovy/Grails code.
codeNarc is one of the best choices for grails projects, thou it is ignoring java classes that potentially are part of your project.
I have not seen any pmd or findBugs plugins for grails that would take care of the java portion. You can use the STS/Eclipse PMD plugin thou to analyze explicitly the src/java/ folder.
Unfortunately the findBugs eclipse-plugin is not able to limit to a certain parts of the project so it no big use (findBugs works purely on class files and works through the complete project).
I guess it should be possible to write a grails pmd plugin that would analyze the java parts of a grails project.
Starting with Grails 3, the build system uses Gradle. There is a PMD gradle plugin which you could use to perform static analysis on your java source files. There is also a Codenarc gradle plugin which you can use to perform analysis on the groovy files in your project.
https://docs.gradle.org/current/userguide/pmd_plugin.html