Surprise, and today spent more than half a day, read the "test-driven development", of course, also need time to digest, so why there are several reconstruction, or a bit confused. .
To join more than a year, the project has done a few. Not a satisfactory. . . . Main coding is very rubbish, poor teamwork, bug pile. Do not want to see their own code.
This software may be received formal education and self-study differences in it!
But this is a good personal feeling, at least know their own deficiencies. So take time to read the Reconstruction, TDD, design patterns and read it again. With some gains, but still need to practice in the development. So from now on in order to force their own development TDD. Ashamed to say, there is no previous projects to test the basic, basic document of all projects end up. (I think this is also the status of the majority of small companies now.)
Today, follow the book, doing the examples, using Ant management procedures have been used somewhat comfortable Ant there before Maven, was not any use because it did not find the superiority of its said. Example of this by using Ant, the feeling that there were some efficiency to increase (which may be the wrong impression), should be more confidence. Because there are tests, double-click the corresponding Ant under the target, the test a few seconds, I feel very comfortable feeling. Confidence and feelings of pleasure to do the next step
As for why the election Ant, rather than the promotion of comparative hot Maven, is the first time since the use of Maven, certainly to the Internet, the slower speed on the depressed, and a bunch of jar to the next, or to build their own warehouses. . . . Personal use of the overhead is too high, it is not worthwhile. Ant on a more flexible, and write a build.xml file to get. What other development tools, what kind of directory structure, I get hand, under amendments to the build.xml file to get the corresponding path.
For the smooth use, specifically to spend time to resolve a number of previously Ant, the outstanding issues.

1. Jee does not matter and is related to swing. Before running swing program using ant always flash, on-line have not found a solution looking for a look yesterday in Q & A javaeye find the answer. Java tag will set the fork attribute to true or on. Means that ant and java will run on a different jvm. The default is to run in a jvm on, so when the ant to run after the end of the swing will naturally shut down.

2.ant start, shut down tomcat, in-line to find the answer.
<target name="run">
        <description>启动tomcat</description>
        <java jar="${tomcat_home}/bin/bootstrap.jar" fork="true">
            <jvmarg value="-Dcatalina.home=${tomcat_home}"/>
        </java>
        <echo>成功启动Tomcat</echo>
    </target>

    <target name="stop">
        <java jar="${tomcat_home}/bin/bootstrap.jar" fork="true">
            <jvmarg value="-Dcatalina.home=${tomcat_home}"/>
            <arg line="stop"/>
        </java>
    </target>

    <target name="debug">
        <java jar="${tomcat_home}/bin/bootstrap.jar" fork="true">
            <jvmarg value="-Dcatalina.home=${tomcat_home}"/>
            <jvmarg value="-Xdebug"/>
            <jvmarg
                    value="-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"/>
        </java>
    </target>


3.ant cancel the deployment of projects, sometimes under the WEB-INF can not delete some jar, resulting in the entire project directory can not be removed, and then lead to the redeployment. Solution, in the META-INF (and WEB-INF directory at the same level) directory, create a context.xml file, enter the following.
<Context path="/你的项目名称" reloadable="true" antiResourceLocking="true" antiJARLocking="true">
</Context>


4 test failure did not stop the test, but also continue to run. Solution, there will be haltonfailure label junit properties and haltonerror, or on attributes can be set to true.

5 I said yesterday for a long time to find the debug function of ant. ant of the debug features and debug features of the IDE should be a different meaning, or is my understanding is wrong. Debug using the IDE's in general are single-step debugging is debugging breakpoint. It seems there is no break point and debug ant capacity (such as the need for additional code, such as analog, not research). But this will need to make up for the test (which is forced to write the initial test of a good way), in fact, breakpoint debugging time than the time spent by the test much longer. Doing projects that deep.

Ant to write some scripts.

1.build_app.xml. Related applications. Including compilation, jar package to run and play.

2.build_web.xml. Related web procedures. Including the compiler, packing.

3.build_test.xml. Test with the above two documents used to build. Compiler to provide test documents, test and generate test reports. Test category at the end with a Test, or build their own document modifications.

4.run_tomcat.xml. related to tomcat, start, close, debug tomcat. Deployment, the abolition of the deployment, start, stop the project, coupled with the use of build_web.xml.

Ant four documents stored in the directory, as long as the establishment of the root build.xml file, it will be necessary to build the import file into it. At the same time, import build_app.xml not build_web.xml documents and files, target names are repeated, and is the two different types of items.

Annex to document release of Ant are interested, do not write build scripts can play. Need to modify the path accordingly.

Finally, the self-wishes for the quality of my code can be improved