Tags

Showing posts with label maven. Show all posts
Showing posts with label maven. Show all posts

Feb 21, 2012

Graphic presentations of FindBugs results using Maven

To enable FindBugs reporting in Maven, just add report section to your pom files



org.codehaus.mojo
findbugs-maven-plugin
2.3

exclude.xml
true
true
Low
Max
true




Then you can just use command mvn site if you want to generate more comprehensive project information or mvn findbugs:findbugs for only FindBugs reports.
Finally use mvn dashboard:dashboard to generate charts.
Voila. We have got nice graphic reports.
Well, not so nice. We have bugs we need to fix.

Dec 26, 2011

Creating new project using maven acrhetype from commnad line

Link:
http://maven.apache.org/archetype/maven-archetype-plugin/usage.html

Steps :
  • Define environmental varible
M2_HOME    Software Foundation\apache-maven-2.2.1
                          path       %M2_HOME%\bin;   (%PATH%;%ANT_HOME%\bin;%JBOSS_HOME%    \bin;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%M2_HOME%\bin;)

  • download maven bin from
                 http://maven.apache.org/download.html
  •       mvn archetype:generate
           It will listdown  all archetype
               Enter archetype ID
               Enter group id
               Enter archetype Id
               Enter version
               Enter package

Jul 5, 2011

Locking user account after max login attempts

Locking user account after max login attempts

@Component
     public class CustomAuthenticationEventListener implements
           ApplicationListener
     {
     public void onApplicationEvent(AbstractAuthenticationEvent event)
              throws LockedException {
           if (event instanceof AuthenticationFailureBadCredentialsEvent) {
              String username = event.getAuthentication().getName();
              UserDTO user = userService.getUserDetails(username);
              if (user != null) {
     int failedLoginAttempts =       user.getFailedLoginAttempts();
     userService.setLoginCounter(username, ++failedLoginAttempts);
     if (failedLoginAttempts == UserDTO.getMaxFailedLoginAttempts()) {
     throw new LockedException(messageSource.getMessage(
     "security.login.form.locked", null, null));
                 }
              }
           }
           if (event instanceof AuthenticationSuccessEvent) {
              String username = event.getAuthentication().getName();
              UserDTO user = userService.getUserDetails(username);
              if (user != null) {
                 userService.setLoginCounter(username, 0);
              }
           }      
        }
     }