3.Netty使用JSerialComm进行串口读取(三)

3.Netty使用JSerialComm进行串口读取(三)

将前面修改的netty-transport-jserialcomm库打包为V2.0.0,然后上传到本地Maven库在IntelliJ IDEA中就可自动下载了。

3.1. 打包

将pom.xml修改使用较新的Maven依赖,打包生成netty-transport-jserialcomm-2.0.0.jar、netty-transport-jserialcomm-2.0.0-javadoc.jar、netty-transport-jserialcomm-2.0.0-sources.jar三个包,

运行Maven->package打包:

在这里插入图片描述

打包成功后运行结果提示如下:

在这里插入图片描述

查看生成文件如下所示:

在这里插入图片描述

3.2. pom.xml具体内容

<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2017 The Netty Project
  ~
  ~ The Netty Project licenses this file to you under the Apache License,
  ~ version 2.0 (the "License"); you may not use this file except in compliance
  ~ with the License. You may obtain a copy of the License at:
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  ~ License for the specific language governing permissions and limitations
  ~ under the License.
  -->
<!--suppress MavenModelInspection -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>se.koc</groupId>
    <artifactId>netty-transport-jserialcomm</artifactId>
    <version>2.0.0</version>
    <packaging>jar</packaging>

    <name>Netty/Transport/jSerialComm</name>
    <description>A Netty Serial Transport using the jSerialComm library</description>
    <url>https://github.com/Ziver/Netty-Transport-jSerialComm</url>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Ziver Koc</name>
            <email>dev@koc.se</email>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/Ziver/Netty-Transport-jSerialComm.git</connection>
        <developerConnection>scm:git:https://github.com/Ziver/Netty-Transport-jSerialComm.git</developerConnection>
        <url>https://github.com/Ziver/Netty-Transport-jSerialComm</url>
    </scm>

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
            <version>4.1.82.Final</version>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-buffer</artifactId>
            <version>4.1.82.Final</version>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-transport</artifactId>
            <version>4.1.82.Final</version>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-codec</artifactId>
            <version>4.1.82.Final</version>
        </dependency>
        <dependency>
            <groupId>com.fazecast</groupId>
            <artifactId>jSerialComm</artifactId>
            <version>2.9.2</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.9.0</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Plugins needed for deployment -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.4.1</version>
                <configuration> <!-- TODO: Temporary until javadoc issues are solved -->
                    <doclint>none</doclint>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.9</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>sonatype-nexus-snapshot</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <distributionManagement>
        <snapshotRepository>
            <id>sonatype-nexus-snapshot</id>
            <name>Sonatype Nexus Snapshots</name>
            <url>http://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-nexus-release</id>
            <name>Nexus Release Repository</name>
            <url>http://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

</project>

3.3. 上传生成的jar包到本地Maven库

上传生成的jar包到本地Maven库,实现IntelliJ IDEA Maven项目从本地Maven仓库自动下载,参考Maven网站netty-transport-jserialcommV1.0.0的目录结构。
在这里插入图片描述
上传步骤如下:

步骤1:把pom.xml文件复制到**{本地Maven根目录}/se/koc/netty-transport-jserialcomm/2.0.0/**目录下,并改名为netty-transport-jserialcomm-2.0.0.pom;

步骤2:把生成的netty-transport-jserialcomm-2.0.0.jar、netty-transport-jserialcomm-2.0.0-javadoc.jar、netty-transport-jserialcomm-2.0.0-sources.jar包复制到**{本地Maven根目录}/se/koc/netty-transport-jserialcomm/2.0.0/**目录下;

在IntelliJ IDEA中配置Maven依赖如下。

<dependency>   
	<groupId>se.koc</groupId>
	<artifactId>netty-transport-jserialcomm</artifactId>
	<version>2.0.0</version>
</dependency>

rt-jserialcomm/2.0.0/**目录下;

在IntelliJ IDEA中配置Maven依赖如下。

<dependency>   
	<groupId>se.koc</groupId>
	<artifactId>netty-transport-jserialcomm</artifactId>
	<version>2.0.0</version>
</dependency>

然后IntelliJ IDEA Maven项目就可从本地Maven仓库自动下载这些jar包了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

静水深流(探索者)

优化算法慢慢学习

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值