昨晚,突然就来了紧急任务。
验签较慢,着手优化,发来一个demo。
首先需要把该demo部署在Linux上。
该项目是maven 项目,所以用maven打个jar包,打完jar包之后,可在Linux上直接执行 java -jar XXXX.jar
所以在pom.xml文件中添加
<
plugin
>
<
artifactId
>
maven-assembly-plugin
</
artifactId
>
<
configuration
>
<
appendAssemblyId
>
false
</
appendAssemblyId
>
<
descriptorRefs
>
<
descriptorRef
>
jar-with-dependencies
</
descriptorRef
>
</
descriptorRefs
>
<
archive
>
<
manifest
>
<!-- 此处指定main方法入口的class -->
<
mainClass
>
test.SignTestMain
</
mainClass
>
</
manifest
>
</
archive
>
</
configuration
>
<
executions
>
<
execution
>
<
id
>
make-assembly
</
id
>
<
phase
>
package
</
phase
>
<
goals
>
<
goal
>
assembly
</
goal
>
</
goals
>
</
execution
>
</
executions
>
</
plugin
>
这段代码就好了。
注意:这是添加在<bui
ld>和<plugins>里面的,完整的如下。
<
build
>
<
plugins
>
<
plugin
>
<
artifactId
>
maven-compiler-plugin
</
artifactId
>
<
configuration
>
<
source
>
1.6
</
source
>
<
target
>
1.6
</
target
>
<
encoding
>
UTF-8
</
encoding
>
</
configuration
>
</
plugin
>
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<archive>
<manifest>
<mainClass>test.SignTestMain</mainClass>
</manifest>
</archive>
<classesDirectory>
</classesDirectory>
</configuration>
</plugin> -->
<
plugin
>
<
artifactId
>
maven-assembly-plugin
</
artifactId
>
<
configuration
>
<
appendAssemblyId
>
false
</
appendAssemblyId
>
<
descriptorRefs
>
<
descriptorRef
>
jar-with-dependencies
</
descriptorRef
>
</
descriptorRefs
>
<
archive
>
<
manifest
>
<!-- 此处指定main方法入口的class -->
<
mainClass
>
test.SignTestMain
</
mainClass
>
</
manifest
>
</
archive
>
</
configuration
>
<
executions
>
<
execution
>
<
id
>
make-assembly
</
id
>
<
phase
>
package
</
phase
>
<
goals
>
<
goal
>
assembly
</
goal
>
</
goals
>
</
execution
>
</
executions
>
</
plugin
>
</
plugins
>
</
build
>
被注释掉的也是打jar包的一种方式,但是你采用这种方式你maven项目所依赖的jar不会被打进去,所以不合适。