Why do dawn need special development configurations?
Dawn uses the Kilim process, which requires code weaving after the end of the encoding. Imagine, if every time you write the program, run the code before running a weaving program manually, it is a matter of how the egg hurts. What's worse, if you don't have the skills to weave, you might lose the opportunity to debug Java code in Eclipse, and the development efficiency will be greatly reduced. So, we can write an ant script to let Eclipse help us automate the weaving.
Steps
We will take dawn this project as an example, as long as the Java project, basically is a similar configuration. If you don't know how to get Dawn source can click here: https://github.com/zhmt/dawn/start:
1. Write the ant script Weaver.xml
This is an ant script, and the script is already in Dawn, so let's take a look at the content:
<?xml version= "1.0" encoding= "UTF-8"? ><project name= "Weaver" default= "weaving" basedir= "." > <property name= "Bindir" value= "./bin"/> <property name= "Libdir" value= "./libs"/> < Path id= "CLSPATTH" ><pathelement location= "${bindir}"/><fileset dir= "${libdir}" ><include name= "* * /*.jar "/></fileset><pathelement path=" ${java.class.path} "/></path><target name=" weaving " ><!--<sleep seconds= "2"/>--><java classname= "kilim.tools.Weaver" fork= "yes" ><classpath Refid= "CLSPATTH"/><arg value= "-D"/><arg value= "${bindir}"/><arg line= "${bindir}"/></java ></target></project>
The purpose here is to call the weaving program, scan the class file in the bin directory, weave it, and write the result into the original class file.
2. Right click on the Dawn Project, select Properties, click on the Builders tab:
3. Click New, create an ant builder, set the weaver.xm we just looked at and set up Base directory,
4. Switch to the Refresh tab with the following settings:
5. Switch to the Targets tab with the following settings:
6. Click OK, Setup is complete, we will see the output in the console, similar to the following:
7. Then set the project compile level to 1.7, the work Gaocheng:
8. Let's verify that:
Run examples The following zhmt.dawn.TestFiberSignal, if the exception is not thrown, it means that the configuration is successful, we have stepped into the gate of asynchronous programming, ready to write in a more simple way full-async Java code it!
Create Mainloop for thread[kilimworker-1,5,main].2 (running=true,pr=null) waiting3 (running=true,pr=null) Waitingsignal (running=true,pr=null) wakensignal (running=true,pr=null) waken
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
[Nio]dawn Development environment Configuration