将源代码安装到本地
mvn clean source:jar install
或者
mvn source:jar
-DskipTests,不执行测试用例,但编译测试用例类生成相应的class文件至target/test-classes下。
-Dmaven.test.skip=true,不执行测试用例,也不编译测试用例类。
mvn clean source:jar install -Dmaven.test.skip=true
或者
mvn source:jar -Dmaven.test.skip=true
打包指定模块(假定工程下面有很多模块)
package -pl project1,project2 -Pproduct
mvn install:install-file -DgroupId=org.nlpcn -DartifactId=elasticsearch-sql -Dversion=6.8.2.0 -Dpackaging=jar -Dfile=elasticsearch-sql-6.8.2.0.jar
mvn install:install-file -DgroupId=org.nlpcn -DartifactId=elasticsearch-sql -Dversion=6.8.2.0 -Dpackaging=jar -Dfile=elasticsearch-sql-6.8.2.0.jar
推送jar到私服
mvn deploy:deploy-file -DgroupId=cn.qzqd -DartifactId=x-pack-sql-jdbc -Dversion=6.8.0 -Dpackaging=jar -Dfile=x-pack-sql-jdbc-6.8.0.jar -Durl=http://192.168.31.5:8081/repository/maven-public/ -DrepositoryId=nexus-releases
mvn deploy:deploy-file -DgroupId=cn.qzqd -DartifactId=x-pack-sql-jdbc -Dversion=6.8.0-SNAPSHOT -Dpackaging=jar -Dfile=x-pack-sql-jdbc-6.8.0.jar -Durl=http://192.168.31.5:8081/repository/maven-snapshots/ -DrepositoryId=nexus-snapshots
推送jar到私服
mvn deploy:deploy-file -DgroupId=cn.qzqd -DartifactId=x-pack-sql-jdbc -Dversion=6.8.0-SNAPSHOT -Dpackaging=jar -Dfile=./x-pack-sql-jdbc-6.8.0-SNAPSHOT.jar -Durl=http://192.168.31.5:8081/repository/maven-snapshots/ -DrepositoryId=nexus-snapshots
如果还不行就在pom.xml中添加下面这段
<repositories>
<repository>
<id>nexus-releases</id>
<name>nexus-releases</name>
<url>http://192.168.31.5:8081/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<layout>default</layout>
</repository>
</repositories>
eslint 设置
To get started, you need to set the ESLint plugin settings:
Go to preferences, ESLint plugin page and check the Enable plugin.
Set the path to the nodejs interpreter bin file.
Select whether to let eslint search for .eslintrc file
Set the path to the eslint bin file. should point to <project path>node_modules/eslint/bin/eslint.js if you installed locally or /usr/local/bin/eslint if you installed globally.
For Windows: install eslint globally and point to the eslint cmd file like, e.g. C:\Users\<username>\AppData\Roaming\npm\eslint.cmd
Set the .eslintrc file, or eslint will use the default settings.
You can also set a path to a custom rules directory.
By default, eslint plugin annotate the editor with warning or error based on the eslint configuration, you can check the 'Treat all eslint issues as warnings' checkbox to display all issues from eslint as warnings.
slf4j 依赖
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.4.5</version>
</dependency>
</dependencies>
logback推荐
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true">
<!-- 应用名称 -->
<property name="APP_NAME" value="appName"/>
<!--日志文件的保存路径,首先查找系统属性-Dlog.dir,如果存在就使用其;否则,在当前目录下创建名为logs目录做日志存放的目录 -->
<property name="LOG_HOME" value="../../logs/"/>
<!-- 日志输出格式 -->
<property name="ENCODER_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss} %-5level [%class:%line] - %m%n"/>
<logger name="org.springframework.core.env.PropertySourcesPropertyResolver" level="info" />
<!-- 控制台日志:输出全部日志到控制台 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>${ENCODER_PATTERN}</Pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- 文件日志:输出全部日志到文件 -->
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/output.%d{yyyy-MM-dd}.log</fileNamePattern>
<!--文件保留天数 -->
<maxHistory>60</maxHistory>
<!--超过此值会删除旧日志 -->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${ENCODER_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<root>
<level value="INFO"/>
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE"/>
</root>
</configuration>
打包jar时排除部分文件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<excludes>
<exclude>**/config/*</exclude>
<exclude>*.yml</exclude>
<exclude>*.xml</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>