Skip to content

游戏插件 game maven plugin

JiangZhiYong edited this page Dec 10, 2017 · 3 revisions

针对此项目封装的maven插件,主要功能:

  • svn更新项目代码
<plugin>
    <groupId>com.jzy.game</groupId>
    <artifactId>game-maven-plugin</artifactId>
    <version>releases</version>
        <executions>
        <execution>
            <id>updateProject</id>
            <phase>clean</phase>
            <goals>
                <goal>updateProject</goal>
            </goals>
        </execution>
    </executions> 
</plugin>
  • mongodb数据库实体类和DAO代码生成
<plugin>
    <groupId>com.jzy.game</groupId>
    <artifactId>game-maven-plugin</artifactId>
    <version>releases</version>
    <configuration>
        <!-- 该目录 entity目录实体自动生成mongo dao -->
        <entityPath>/com/jzy/game/model/mongo</entityPath>
    </configuration>
    <executions>
        <!-- 生成配置文件实体类 -->
        <execution>
            <configuration>
                <!-- 实体类生成路径 -->
                <entityPackage>\com\jzy\game\model\mongo\bydr\entity</entityPackage>
                <!-- 配置表路径 -->
                <configTablePath>E:\Java\game-server\game-config\src\main\resources\table</configTablePath>
            </configuration>
            <id>mongoEntity</id>
            <goals>
                <goal>mongoEntity</goal>
            </goals>
        </execution>

        <!-- 生成配置文件dao -->
        <execution>
            <id>mongoDao</id>
            <goals>
                <goal>mongoDao</goal>
            </goals>
        </execution>
    </executions>
</plugin>
  • 生成protobuf消息处理器Handler,并进行消息注册
<plugin>
    <groupId>com.jzy.game</groupId>
    <artifactId>game-maven-plugin</artifactId>
    <version>releases</version>
    <configuration>
        <messagePath>\com\jzy\game\message\bydr</messagePath>	<!-- protobuf类路径 -->
        <scriptPath>\com\jzy\game\bydr\tcp</scriptPath>	<!-- 生成Handler类路径 -->
    </configuration>
    <executions>
        <execution>
            <!-- 生成消息处理器 -->
            <id>tcpHandler</id>
            <phase>clean</phase>
            <goals>
                <goal>tcpHandler</goal>
            </goals>
        </execution>
    </executions>
</plugin>