maven 打jar 包 能运行main() 方法


MyEclipse + Maven开发Web工程的详细配置过程
http://b-l-east.iteye.com/blog/1246482



用maven 创建基于spring的可执行的jar
http://www.yihaomen.com/article/java/393.htm

使用 maven 插件 maven-shade-plugin 对 java 工程及其全部依赖 jar 进行打包
http://blog.csdn.net/leonzhouwei/article/details/9978771

执行Jar包报错:Could not find the main class 
http://xyzhang81.blog.163.com/blog/static/311143732013031113621210/

问题解决:发现jar包META-INF目录下有一个名为*.SF的文件,删除该文件后问题解决。




<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.3</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.edinner.datasync.main.Main</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.tooling</resource>
</transformer>

</transformers>
</configuration>
</execution>
</executions>
</plugin>


</plugins>
</build>

你可能感兴趣的:(maven)