1. Download source code

Fork code from github repository to your own repository github.com/netty/netty and clone it locally. Netty uses Maven for project management, so it is much more convenient than Gradle. You can open it directly with IDEA

2. There is no problem with the class

Clone code, we find the example io.net ty. Example. HTTP. Websocketx. Server WebSocketServer, ready to debug starts, this time found within the codec – redis module of some packet error are introducedThe Netty-common module does not have these classes, but it does have a Groovy script. Go to the netty-common directory and run MVN compile. Found an errorA netty-Tools package cannot be downloaded

3. Resolve the dev-tools problem

We found actually netty – common in compilation phase does not need io.net ty: netty – dev – tools: jar this package, so the father pom file, put this code is commented out

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-remote-resources-plugin</artifactId> The < version > 1.5 < / version > < configuration > < resourceBundles > <resourceBundle>io.netty:netty-dev-tools:${project.version}</resourceBundle> </resourceBundles> <outputDirectory>${netty.dev.tools.directory}</outputDirectory> <attachToMain>false</attachToMain> <attachToTest>false</attachToTest> </configuration> <executions> <execution> <goals> <goal>process</goal> </goals> </execution> </executions> </plugin>Copy the code

Also remove references to dev-tools in The pom.xml of Netty-common

<dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-dev-tools</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
      <optional>true</optional>
    </dependency>
Copy the code

Then run the MVN clean package-dmaven.test. skip=true command in netty-common. The class file is successfully discovered in the target of netty-common

4. Run the example

Run the io.net ty. Example. HTTP. Websocketx. Server WebSocketServer, normal boot programNext you can debug while looking at the source code

For more exciting content, please pay attention to the public number