打包时出现异常

打包时出现异常

[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Malformed POM D:\STUDY\J2EE\maven-first\pom.xml: Unrecognised tag: 'id' (position: START_TAG seen ...<!-- \u521b\u5efa\u79c1\u670d\u5730\u5740 -->\r\n\t\t<id>... @28:7)  @ D:\STUDY\J2EE\maven-first\pom.xml, line 28, column 7
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.zcl:maven-first:1.0.0.RELEASE (D:\STUDY\J2EE\maven-first\pom.xml) has 1 error
[ERROR]     Malformed POM D:\STUDY\J2EE\maven-first\pom.xml: Unrecognised tag: 'id' (position: START_TAG seen ...<!-- \u521b\u5efa\u79c1\u670d\u5730\u5740 -->\r\n\t\t<id>... @28:7)  @ D:\STUDY\J2EE\maven-first\pom.xml, line 28, column 7 -> [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
<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.zcl</groupId>
	<artifactId>maven-first</artifactId>
	<version>1.0.0.RELEASE</version>
	<dependencies>
	<!-- 创建依赖 -->
		<dependency>
			<groupId>com.github.bj-tydic</groupId>
			<artifactId>async-mysql-connector</artifactId>
			<version>1.7</version>
		</dependency>
		<dependency>
			<groupId>com.belerweb</groupId>
			<artifactId>pinyin4j</artifactId>
			<version>2.5.1</version>
		</dependency>
		<dependency>
			<groupId>co.paralleluniverse</groupId>
			<artifactId>comsat-spring-webmvc</artifactId>
			<version>0.7.0</version>
		</dependency>
	</dependencies>
	<repositories>
	<!-- 创建私服地址 -->
		<id>aliyun</id>
		<name>aliyun</name>
		<url>https://maven.aliyun.com/repository/public</url>
	</repositories>
	<build>
	<!-- 配置插件 -->
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-assembly-plugins</artifactId>
			<version>2.5.5</version>
			<configuration>
			<!-- 配置入口类 -->
				 <archive>
                    <manifest>
                        <mainClass>com.zcl.maven.PinyinTestor</mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                <!-- all in one ,打包时将所有引用的jar合并到输出的jar文件中 -->
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
              	
			</configuration>
			 
		</plugin>
	</plugins>
	</build>
	
</project>
package com.zcl.maven;

import java.util.Scanner;

import net.sourceforge.pinyin4j.PinyinHelper;

public class PinyinTestor {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		String[] str1 = PinyinHelper.toHanyuPinyinStringArray(str.charAt(0));
		for(String py:str1) {
			System.out.println(py);
		}
	}
}

老师打包时出问题了,看不太懂这个异常

正在回答 回答被采纳积分+1

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

3回答
好帮手慕柯南 2019-09-02 10:20:15

同学你好!

在<plugins>下添加以下插件测试一下。

<plugin>  
        <groupId>org.apache.maven.plugins</groupId>  
        <artifactId>maven-surefire-plugin</artifactId>  
        <version>2.4.2</version>  
        <configuration>  
          <skipTests>true</skipTests>  
        </configuration>  
</plugin>

祝学习愉快~

好帮手慕柯南 2019-09-01 11:33:55

同学你好!

同学将pom文件替换为以下样式测试一下:

<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.zcl</groupId>
    <artifactId>maven-first</artifactId>
    <version>1.0.0.RELEASE</version>
    <dependencies>
    <!-- 创建依赖 -->
        <dependency>
            <groupId>com.github.bj-tydic</groupId>
            <artifactId>async-mysql-connector</artifactId>
            <version>1.7</version>
        </dependency>
        <dependency>
            <groupId>com.belerweb</groupId>
            <artifactId>pinyin4j</artifactId>
            <version>2.5.1</version>
        </dependency>
        <dependency>
            <groupId>co.paralleluniverse</groupId>
            <artifactId>comsat-spring-webmvc</artifactId>
            <version>0.7.0</version>
        </dependency>
    </dependencies>
     <repositories>
        <repository>
            <id>aliyun</id>
            <name>aliyun</name>
            <url>https://maven.aliyun.com/repository/public</url>
        </repository>
    </repositories>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.5.5</version>
            <configuration>
                <archive>
                    <manifest>com.lgq.maven.PinyinTestor</manifest>
                </archive>
                <descriptorRefs>
                    <!-- all in one,在打包时将所有引用的jar包合并到输出的jar文件中 -->
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
        </plugin>
    </plugins>
</build>
</project>

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

  • 提问者 飞天小栗旬 #1
    老师代码修改完了,还是有错误: [INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.12.4/surefire-api-2.12.4.jar (118 kB at 324 B/s) [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 39:18 min [INFO] Finished at: 2019-09-01T22:54:50+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project maven-first: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could not be resolved: Could not transfer artifact org.apache.maven:maven-toolchain:jar:2.0.9 from/to central (https://repo.maven.apache.org/maven2): GET request of: org/apache/maven/maven-toolchain/2.0.9/maven-toolchain-2.0.9.jar from central failed: Read timed out -> [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/PluginResolutionException
    2019-09-01 23:52:59
好帮手慕阿满 2019-08-31 11:16:38

同学你好,这个报错是指未识别的标签id,如:

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

应该是创建阿里私服地址时报错。建议同学将去掉阿里私服地址再打包试试。

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

  • 提问者 飞天小栗旬 #1
    老师我把私服地址配置那个删除了其他的没动,出现了这个错误 [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 57.998 s [INFO] Finished at: 2019-09-01T10:28:33+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project maven-first: Compilation failure [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? [ERROR] -> [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/MojoFailureException
    2019-09-01 10:36:11
问题已解决,确定采纳
还有疑问,暂不采纳

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

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

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

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