请问这个报错如何解决

来源:1-6 项目打包

JavaNice

2019-07-04 00:05:25

[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< com.wdnmd:MyFirstMaven >-----------------------
[INFO] Building MyFirstMaven 1.0.0-RELEASE
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] >>> maven-assembly-plugin:2.5.5:assembly (default-cli) > package @ MyFirstMaven >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MyFirstMaven ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ MyFirstMaven ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ MyFirstMaven ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ MyFirstMaven ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ MyFirstMaven ---
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ MyFirstMaven ---
[INFO] 
[INFO] <<< maven-assembly-plugin:2.5.5:assembly (default-cli) < package @ MyFirstMaven <<<
[INFO] 
[INFO] 
[INFO] --- maven-assembly-plugin:2.5.5:assembly (default-cli) @ MyFirstMaven ---
[INFO] Building jar: D:\JavaEcilpsePro\Java_MavenProTest\MyFirstMaven\target\MyFirstMaven-1.0.0-RELEASE-jar-with-dependencies.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.711 s
[INFO] Finished at: 2019-07-04T00:00:34+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.5.5:assembly (default-cli) on project MyFirstMaven: Failed to create assembly: Error creating assembly archive jar-with-dependencies: IOException when zipping rMETA-INF/services/java.sql.Driver: invalid LOC header (bad signature) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
<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/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.wdnmd</groupId>
	<artifactId>MyFirstMaven</artifactId>
	<version>1.0.0-RELEASE</version>
	
	<!-- 调用阿里云的库 -->
	<repositories>
		<repository>
			<id>aly</id>
			<name>aly</name>
			<url>https://maven.aliyun.com/repository/public</url>
		</repository>
	</repositories>
	
	<!-- dependencies依赖 -->
	<dependencies>
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>8.0.16</version>
		</dependency>
		<dependency>
  			<groupId>com.belerweb</groupId>
  			<artifactId>pinyin4j</artifactId>
  			<version>2.5.1</version>
		</dependency>
	</dependencies>
	
	<!-- 构建导出插件 -->
	<build>
		<!-- 配置插件 -->
		<plugins>
			<!--  -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<!-- 使用assembly进行装配 -->
				<artifactId>maven-assembly-plugin</artifactId>	
				<version>2.5.5</version>
				<!-- 对打包过程进行一些说明 -->
				<configuration>
					<archive>
						<manifest>
							<!-- 类的主入口 -->
							<mainClass>com.wdnmd.maven.PinyinTest</mainClass>
						</manifest>
					</archive>
					<!-- 标识符描述:打包过程中需要的参数-->
					<descriptorRefs>
						<!-- all in one, 在打包时会将所以引用的jar合并到输出的jar文件中 -->
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

http://img.mukewang.com/climg/5d1cd20e0001050d10950291.jpg

最后一个包应该是没导成功

写回答

2回答

芝芝兰兰

2019-07-04

同学你好,可以查看一下同学本地的数据库版本是不是8开头的:

打开cmd,使用“mysql --version”

http://img.mukewang.com/climg/5d1d9adb0001eb4805900053.jpg

如果是5开头的版本,则需要将mysql组件的版本修改为一致的:

http://img.mukewang.com/climg/5d1d9b370001d64104890191.jpg

修改pom文件后,项目上右键,Maven -> Update Project

http://img.mukewang.com/climg/5d1d9c3c0001885807510354.jpg

如果解答了同学的疑问,望采纳~

祝学习愉快~


0

JavaNice

提问者

2019-07-04

http://img.mukewang.com/climg/5d1cd5140001be8f09660209.jpg

http://img.mukewang.com/climg/5d1cd53a0001208e06870459.jpg

0

0 学习 · 8016 问题

查看课程