打包的时候出现了error 麻烦老师看看

打包的时候出现了error 麻烦老师看看

这是pom.xml:
<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.imooc</groupId>
  <artifactId>maven-first</artifactId>
  <version>1.0.0-release</version>
  <repositories>
  	<repository>
  	<!-- 创建私服的地址 -->
  	<id>aliyun</id>
  	<name>aliyun</name>
  	<url>https://maven.aliyun.com/repository/public</url>
  	</repository>
  </repositories>
<dependencies>
	<dependency>
	  <groupId>mysql</groupId>
	  <artifactId>mysql-connector-java</artifactId>
	  <version>8.0.17</version>
	</dependency>
	<dependency>
	  <groupId>com.belerweb</groupId>
	  <artifactId>pinyin4j</artifactId>
	  <version>2.5.1</version>
	</dependency>
	<dependency>
	  <groupId>org.springframework</groupId>
	  <artifactId>spring-webmvc</artifactId>
	  <version>5.1.10.RELEASE</version>
	</dependency>
</dependencies>
<build>
	<!-- 配置插件 -->
	<plugins>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-assembly-plugin</artifactId>
		<version>2.5.5</version>
		<configuration>
			<archive>
				<manifest>
					<mainClass>com.imooc.maven.PinyinTestor</mainClass>
				</manifest>
			</archive>
			<descriptorRefs>
			<!-- all in one,在打包时会将所有引用的jar合并到输出的jar文件中 -->
				<descriptorRef>jar-with-dependencies</descriptorRef>
			</descriptorRefs>
		</configuration>
	</plugins>
</build>
</project>

报错:
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Malformed POM D:\eclipse-workspace\maven-first\pom.xml: Unrecognised tag: 'groupId' (position: START_TAG seen ...<plugins>\r\n\t\t<groupId>... @34:12)  @ D:\eclipse-workspace\maven-first\pom.xml, line 34, column 12
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.imooc:maven-first:1.0.0-release (D:\eclipse-workspace\maven-first\pom.xml) has 1 error
[ERROR]     Malformed POM D:\eclipse-workspace\maven-first\pom.xml: Unrecognised tag: 'groupId' (position: START_TAG seen ...<plugins>\r\n\t\t<groupId>... @34:12)  @ D:\eclipse-workspace\maven-first\pom.xml, line 34, column 12 -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException

http://img1.sycdn.imooc.com//climg/5db6c00b092468c508330702.jpg

正在回答

登陆购买课程后可参与讨论,去登陆

2回答

同学你好!

  1. 请问同学的plugin标签的外层是否有plugins标签呢?同学这里原来的代码是没有写plugin标签的,同学是否使用它替换了plugins标签了呢?

  2. 这里同学将plugin标签的内容替换了plugins标签的内容测试一下比如:

<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.imooc.maven.PinyinTestor</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

    3. 如果还报错,建议同学贴一下最新的pom文件,以及报错信息。注意在我要回答中贴出,回复里会改变代码的格式

http://img1.sycdn.imooc.com//climg/5db7b08209af871508650164.jpg

如果我的回答解决了你的疑惑,请采纳,祝学习愉快~


好帮手慕阿满 2019-10-28 19:25:04

同学你好,建议同学删除之前的plugin,替换为如下的plugin再试试,如:

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.imooc.maven.PinyinTestor</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~

  • 提问者 shuaiyi #1
    [INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [ERROR] Malformed POM D:\eclipse-workspace\maven-first\pom.xml: Unrecognised tag: 'plugin' (position: START_TAG seen ...<!-- \u914d\u7f6e\u63d2\u4ef6 -->\r\n\t<plugin>... @33:10) @ D:\eclipse-workspace\maven-first\pom.xml, line 33, column 10 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project com.imooc:maven-first:1.0.0-release (D:\eclipse-workspace\maven-first\pom.xml) has 1 error [ERROR] Malformed POM D:\eclipse-workspace\maven-first\pom.xml: Unrecognised tag: 'plugin' (position: START_TAG seen ...<!-- \u914d\u7f6e\u63d2\u4ef6 -->\r\n\t<plugin>... @33:10) @ D:\eclipse-workspace\maven-first\pom.xml, line 33, column 10 -> [Help 2] [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/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException 就按老师说的 删了built里的那部分代码替换为了老师给的 然后还是出错了 错误部分还是plugin 是不是其他地方错了 但是也没改动什么其他的
    2019-10-28 20:14:59
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师