【问题标题】:When running "mvn test" on command prompt, error was encountered在命令提示符下运行“mvn test”时遇到错误
【发布时间】:2019-06-21 02:53:14
【问题描述】:

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

命令提示符:

[错误] 执行 Maven 时出错。 [错误] 遇到 1 个问题,同时 构建有效设置 [致命] 不可解析的设置 C:\Program Files\apache-maven-3.6.0\bin..\conf\settings.xml:结束标记 名称必须与第 102 行的开始标签名称匹配 \n -->\n... @254:12> @C:\程序 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>

【问题讨论】:

    标签: eclipse maven selenium automation command-prompt


    【解决方案1】:

    在第 987654324@ 行,您只需评论 &lt;servers&gt; 的开头和在第 102 的第 &lt;servers&gt; 行关闭,错误说明了,您传递了标签上不必要的评论,请删除评论签到。。

    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

    【讨论】:

      【解决方案2】:

      不可解析的设置

      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 的结尾,这就是您收到“不可解析设置”错误的原因。

      【讨论】:

      • 当您执行的目录中没有 pom.xml 文件时会出现此错误
      • C:\Users\mnolasco 是否包含 pom.xml?
      • 尝试运行mvn clean install 看看你得到了什么输出?
      • 可以分享C:\Users\mnolasco目录下的文件内容吗?如果您在 Windows 中工作,请使用 dir 命令获取文件,或在 MacOS/Linux 中使用 ls
      • .eclipse、.m2、.p2、.tooling、.eclipse-workspace 和我的文件
      猜你喜欢
      • 1970-01-01
      • 2019-11-13
      • 2012-10-27
      • 2021-10-25
      • 1970-01-01
      • 2015-10-21
      • 1970-01-01
      • 1970-01-01
      • 2021-08-28
      相关资源
      最近更新 更多