Initiative Struts 2.5 project for test driven development (TDD) | Trần Đình Thoại

Initiative Struts 2.5 project for test driven development (TDD)

1. Create Dynamic Web project, for example at C:\Startup

2. Convert to Maven project

3. Download and unzip TDD-Struts-Blank.zip, for example at C:\Blank

4. Add following lines to C:\Startup\pom.xml, then build

<dependencies>
      <dependency>
         <groupId>org.apache.struts</groupId>
         <artifactId>struts2-core</artifactId>
         <version>2.5</version>
      </dependency>
      <dependency>
         <groupId>org.apache.logging.log4j</groupId>
         <artifactId>log4j-core</artifactId>
         <version>2.5</version>
      </dependency>
      <dependency>
         <groupId>org.apache.struts</groupId>
         <artifactId>struts2-junit-plugin</artifactId>
         <version>2.5</version>
      </dependency>      
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>4.12</version>
      </dependency>
   </dependencies>

5. Add following lines to C:\Startup\pom.xml, then build


   <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-dependency-plugin</artifactId>
      <version>2.6</version>
      <executions>
         <execution>
            <id>copy-dependencies</id>
            <phase>build</phase>
            <goals>
               <goal>copy-dependencies</goal>
            </goals>
            <configuration>
               <outputDirectory>${project.build.directory}/lib</outputDirectory>
               <overWriteReleases>true</overWriteReleases>
               <overWriteSnapshots>true</overWriteSnapshots>
               <overWriteIfNewer>true</overWriteIfNewer>
            </configuration>
         </execution>
      </executions>
   </plugin>


6. Run following commands, for example on Windows 7

md c:\Startup\src\java

md c:\Startup\src\tests

7. Remove current source folder and add 2 new source folder at c:\Startup\src\java and c:\Startup\src\tests

8. Run following commands, for example on Windows 7

copy C:\Blank\src\java\* C:\Startup\src\java

copy C:\Blank\src\tests\* C:\Startup\src\tests

copy C:\Blank\WebContent\WEB-INF\* C:\Startup\WebContent\WEB-INF

Tuesday, May 31, 2016 at 12:28 AM