在命令提示符下运行“ MVN测试”时,遇到错误

时间:2019-01-28 06:02:11

标签: eclipse maven selenium automation command-prompt

在命令提示符下运行“ mvn测试”时,遇到错误。我需要运行“ mvn test”以使用Maven和Java测试报告JUnit插件。

命令提示符:

  

[错误]执行Maven时出错。 [错误]时遇到1个问题   建立有效设置[FATAL]不可解析的设置   C:\ Program Files \ apache-maven-3.6.0 \ bin .. \ conf \ settings.xml:结束标记   名称必须与第102行中的开始标记名称匹配   \ n-> \ n ...   @ 254:12> @ C:\ Program   Files \ apache-maven-3.6.0 \ bin .. \ conf \ settings.xml,第254行,第12列

settings.xml

46<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
47          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
48          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
49  <!-- localRepository
50   | The path to the local repository maven will use to store artifacts.
51   |
52   | Default: ${user.home}/.m2/repository
53  -->
54  <localRepository>C:\Users\hiddenuser\.m2\repository</localRepository>
55  
56  <!-- interactiveMode
57   | This will determine whether maven prompts you when it needs input. If set to false,
58   | maven will use a sensible default value, perhaps based on some other setting, for
59   | the parameter in question.
60   |
61   | Default: true
62  <interactiveMode>true</interactiveMode>
63  -->
64
65  <!-- offline
66   | Determines whether maven should attempt to connect to the network when executing a build.
67   | This will have an effect on artifact downloads, artifact deployment, and others.
68   |
69   | Default: false
70  <offline>false</offline>
71  -->
72
73  <!-- pluginGroups
74   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
75   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
76   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
77   |-->
78  <pluginGroups>
79    <!-- pluginGroup
80   | Specifies a further group identifier to use for plugin lookup.
81    <pluginGroup>com.your.plugins</pluginGroup>
82    -->
83  </pluginGroups>
84
85  <proxies>
86    <proxy>
87      <id>optional</id>
88      <active>true</active>
89      <protocol>http</protocol>
90      <!-- <username></username>
91      <password></password> -->
92      <host>hidden only</host>
93      <port>hidden only</port>
94      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
95    </proxy>
96  <proxies>
97  
98  <!-- servers
99   | This is a list of authentication profiles, keyed by the server-id used within the system.
100  | Authentication profiles can be used whenever maven must make a connection to a remote server.
101  |-->
102  <servers>

2 个答案:

答案 0 :(得分:1)

在第92行,您只评论<servers>的开头,而在第102行,它正在关闭<servers>,错误本身表明,您传递了不必要的内容对标签发表评论,请删除评论符号。

end tag name must match start tag name from line 102

因此,请更新文件并再次执行,让我们知道此解决方案对您有无帮助

供参考,请访问官方网站以获取更多信息

https://maven.apache.org/settings.html

获得更多参考

Error "The goal you specified requires a project to execute but there is no POM in this directory" after executing maven command

maven generating pom file

答案 1 :(得分:0)

不可解析的设置

  

C:\ Program Files \ apache-maven-3.6.0 \ bin .. \ conf \ settings.xml:结束标记   名称必须与第102行中的开始标记名称匹配

您的settings.xml文件存在一些语法错误,请尝试以下内容:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <!-- localRepository | The path to the local repository maven will use to 
        store artifacts. | | Default: ${user.home}/.m2/repository -->
    <localRepository>C:\Users\hiddenuser\.m2\repository</localRepository>

    <!-- interactiveMode | This will determine whether maven prompts you when 
        it needs input. If set to false, | maven will use a sensible default value, 
        perhaps based on some other setting, for | the parameter in question. | | 
        Default: true <interactiveMode>true</interactiveMode> -->

    <!-- offline | Determines whether maven should attempt to connect to the 
        network when executing a build. | This will have an effect on artifact downloads, 
        artifact deployment, and others. | | Default: false <offline>false</offline> -->

    <!-- pluginGroups | This is a list of additional group identifiers that 
        will be searched when resolving plugins by their prefix, i.e. | when invoking 
        a command line like "mvn prefix:goal". Maven will automatically add the group 
        identifiers | "org.apache.maven.plugins" and "org.codehaus.mojo" if these 
        are not already contained in the list. | -->
    <pluginGroups>
        <!-- pluginGroup | Specifies a further group identifier to use for plugin 
            lookup. <pluginGroup>com.your.plugins</pluginGroup> -->
    </pluginGroups>

    <proxies>
        <proxy>
            <id>optional</id>
            <active>true</active>
            <protocol>http</protocol>
            <!-- <username></username> <password></password> -->
            <host>hidden only</host>
            <port>hidden only</port>
            <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
        </proxy>
    </proxies>

    <!-- servers | This is a list of authentication profiles, keyed by the server-id 
        used within the system. | Authentication profiles can be used whenever maven 
        must make a connection to a remote server. | -->
    <servers>
    </servers>
</settings>

您尚未在settings.xml文件中指定与/ servers和/ settings匹配的结尾,这就是为什么出现“非可解析的设置”错误的原因。