开发代码生成器时,需要打包成可执行文件
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.png</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached><!--这个会另外生成shade包 并导入的所有依赖-->
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>*.*.MainCalss</mainClass><!--main方法所在类含包路径的类名-->
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugins>
<resources>
</build>
在执行可执行文件时,又出现了如下错误
Invalid signature file digest for Manifest main attributes
可以执行命令去掉包中的内容
zip -d yourjarname.jar META-INF/*.RSA META-INF/*.DSA META-INF/*.SF