Forums Register Login

Looking for a Maven Plugin

+Pie Number of slices to send: Send
Anyone know of a Maven plugin that will enforce design rules? I would like to be able to cause a build error when someone does things like throwing SQLException from DAO layer or when a method in Service object excepts a Hibernate specific Object.
+Pie Number of slices to send: Send
The problem is this comes in the realm of Design Patterns, and Design Patterns aren't overly amenable to automated anything. Otherwise there'd be extortionately-priced software suites designed to exploit that. Instead what we have is mostly DIY, although the Iterator pattern is now built into Java itself.

There are some things that can help. A product that can scan for questionable usages whose exact name escapes me (it's something like BugBuddy). I think it is supported by a Maven plugin, but it's also something that can plug into an IDE.

Likewise, some of the UML tools try to help. I know that the open-source ArgoUML tool does. But that's all interactive critiquing, not batch-mode, so it's hard to make Maven work with it.
+Pie Number of slices to send: Send
Thanks,

I think the ideal solution would allow me to list packages that classes in a certain package cannot use. Ideally, it would have regular expression matching as well.

So I could say (in a config file) something like...



I know this would save me a bit of refactoring if these types of things were caught by developers.
+Pie Number of slices to send: Send
That wouldn't be a very difficult app to write. (ahem) "All You Have To Do Is..."

Well, seriously. Load up the XML file using apache digester or similar. Read the classfiles in the project, looking for violations by pattern-matching the signatures of method calls. Report them.

Easily done in less than a day.

Meaning that in Real Life, I'd put aside 2-3 weeks to get it all working, especially as a mojo. But still, at the conceptual level, it's fairly simple.
+Pie Number of slices to send: Send
yea, that part of it would be simple enough. However, I would want the usage to be checked as well (if possible).
+Pie Number of slices to send: Send
 

Tim Holloway wrote:
There are some things that can help. A product that can scan for questionable usages whose exact name escapes me (it's something like BugBuddy). I think it is supported by a Maven plugin, but it's also something that can plug into an IDE.


I guess you are referring to FindBugs (http://findbugs.sourceforge.net) or PMD (http://pmd.sourceforge.net/). Both tools can be extended by customized rules. But from top of my head I can't think of any rule, which would check for certain exceptions. But maybe it's a better starting point than writing a customized tool from scratch.
+Pie Number of slices to send: Send
 

Joachim Rohde wrote:I guess you are referring to FindBugs (http://findbugs.sourceforge.net) or PMD (http://pmd.sourceforge.net/). Both tools can be extended by customized rules. But from top of my head I can't think of any rule, which would check for certain exceptions. But maybe it's a better starting point than writing a customized tool from scratch.



Thanks, I'll check these out. I am not talking about just checking for exceptions though. Any package usage at all and I would want it to fail. For instance, my DAO's should not be tightly coupled with a DB, so I would not want the DAO interfaces to use (return, throw, or accept as argument) any classes in the javax.sql package.
+Pie Number of slices to send: Send
Did you already have a look at checkstyle?
Good heavens! What have you done! Here, try to fix it with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1073 times.
Similar Threads
Eclipse - JSF - Spring tool suite - Hibernate
maven -- java.lang.OutOfMemoryError: Java heap space
Unable to find mojo 'validate'
Download Maven plugin
Maven Error - Unable to find repo
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:37:10.