Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java “中的原型插件错误”;Maven在5分钟内完成”;辅导的_Java_Maven_Maven Archetype - Fatal编程技术网

Java “中的原型插件错误”;Maven在5分钟内完成”;辅导的

Java “中的原型插件错误”;Maven在5分钟内完成”;辅导的,java,maven,maven-archetype,Java,Maven,Maven Archetype,我正在尝试教程,几乎马上就遇到了一个错误。mvn--version的结果如下 Apache Maven 3.5.2 Maven home: /usr/share/maven Java version: 1.8.0_171, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linu

我正在尝试教程,几乎马上就遇到了一个错误。
mvn--version
的结果如下

Apache Maven 3.5.2
Maven home: /usr/share/maven
Java version: 1.8.0_171, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-23-generic", arch: "amd64", family: "unix"
当我运行教程中的下一个命令时

$ mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app \
   -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
我得到以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli)
on project standalone-pom: archetypeCatalog 'http://mavenrepo.openmrs.org/nexus/content/repositories/public/archetype-catalog.xml'
is not supported anymore. Please read the plugin documentation for details. -> [Help 1]
其中“帮助1”只是一个例子

似乎原型插件发布了一个突破性的变化,Maven教程也没有更新以反映这一点。不过,有趣的是

也会因相同的错误而失败

是否仍然可以基于Quickstart原型生成maven项目,如果可以,我该如何做

编辑:这是我的
~/.m2/settings.xml
文件:

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <server>
      <username>${env.BINTRAY_USER}</username>
      <password>${env.BINTRAY_API_KEY}</password>
      <id>bintray-sdk</id>
    </server>
  </servers>
  <profiles>
    <profile>
      <properties>
        <archetypeRepository>http://mavenrepo.openmrs.org/nexus/content/repositories/public</archetypeRepository>
        <archetypeCatalog>http://mavenrepo.openmrs.org/nexus/content/repositories/public/archetype-catalog.xml</archetypeCatalog>
      </properties>
      <repositories>
        <repository>
          <id>openmrs-repo</id>
          <name>OpenMRS Nexus Repository</name>
          <url>http://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
        </repository>
        <repository>
          <id>openmrs-repo-thirdparty</id>
          <name>OpenMRS Thirdparty Nexus Repository</name>
          <url>http://mavenrepo.openmrs.org/nexus/content/repositories/thirdparty</url>
        </repository>
        <repository>
          <id>openmrs-bintray-repo</id>
          <name>OpeMRS Maven Bintray Repository</name>
          <url>https://dl.bintray.com/openmrs/maven/</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>openmrs-repo</id>
          <name>OpenMRS Nexus Repository</name>
          <url>http://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
        </pluginRepository>
        <pluginRepository>
          <id>openmrs-bintray-repo</id>
          <name>OpeMRS Maven Bintray Repository</name>
          <url>https://dl.bintray.com/openmrs/maven/</url>
        </pluginRepository>
      </pluginRepositories>
      <id>openmrs</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>openmrs</activeProfile>
  </activeProfiles>
  <pluginGroups>
    <pluginGroup>org.openmrs.maven.plugins</pluginGroup>
  </pluginGroups>
</settings>

${env.BINTRAY\u USER}
${env.BINTRAY\u API\u KEY}
bintray sdk
http://mavenrepo.openmrs.org/nexus/content/repositories/public
http://mavenrepo.openmrs.org/nexus/content/repositories/public/archetype-catalog.xml
openmrs回购
OpenMRS Nexus存储库
http://mavenrepo.openmrs.org/nexus/content/repositories/public
openmrs回购第三方
OpenMRS第三方关系存储库
http://mavenrepo.openmrs.org/nexus/content/repositories/thirdparty
复式回购
OpeMRS Maven Bintray存储库
https://dl.bintray.com/openmrs/maven/
假的
openmrs回购
OpenMRS Nexus存储库
http://mavenrepo.openmrs.org/nexus/content/repositories/public
复式回购
OpeMRS Maven Bintray存储库
https://dl.bintray.com/openmrs/maven/
openmrs
openmrs
org.openmrs.maven.plugins

事实上,正如错误消息所示,不推荐使用
archetypeCatalog
。您必须从
设置.xml
中删除属性
archetypeRepository
archetypeCatalog
,并将
archetype
的存储库声明为
id
,如下所示:


openmrs
原型
http://mavenrepo.openmrs.org/nexus/content/repositories/public

您的活动配置文件是
openmrs
,因此应使用此配置找到原型,因为它们存在于
openmrs
存储库中(请参阅)。

您知道
http://mavenrepo.openmrs.org/nexus/
来自哪里?它是在您的
设置.xml
中配置的存储库吗?啊,显然是的。这是我的
settings.xml
文件:。这是某种名称空间冲突吗?有没有可能在不从Maven配置中删除对OpenMRS的支持的情况下解决这个问题?好的,我想我已经找到了问题所在,请检查下面的答案。您是否可以编辑您的问题并将
settings.xml
的内容直接发布到其中?它可以帮助其他人面对同样的问题,而不必阅读评论部分。
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <server>
      <username>${env.BINTRAY_USER}</username>
      <password>${env.BINTRAY_API_KEY}</password>
      <id>bintray-sdk</id>
    </server>
  </servers>
  <profiles>
    <profile>
      <properties>
        <archetypeRepository>http://mavenrepo.openmrs.org/nexus/content/repositories/public</archetypeRepository>
        <archetypeCatalog>http://mavenrepo.openmrs.org/nexus/content/repositories/public/archetype-catalog.xml</archetypeCatalog>
      </properties>
      <repositories>
        <repository>
          <id>openmrs-repo</id>
          <name>OpenMRS Nexus Repository</name>
          <url>http://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
        </repository>
        <repository>
          <id>openmrs-repo-thirdparty</id>
          <name>OpenMRS Thirdparty Nexus Repository</name>
          <url>http://mavenrepo.openmrs.org/nexus/content/repositories/thirdparty</url>
        </repository>
        <repository>
          <id>openmrs-bintray-repo</id>
          <name>OpeMRS Maven Bintray Repository</name>
          <url>https://dl.bintray.com/openmrs/maven/</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>openmrs-repo</id>
          <name>OpenMRS Nexus Repository</name>
          <url>http://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
        </pluginRepository>
        <pluginRepository>
          <id>openmrs-bintray-repo</id>
          <name>OpeMRS Maven Bintray Repository</name>
          <url>https://dl.bintray.com/openmrs/maven/</url>
        </pluginRepository>
      </pluginRepositories>
      <id>openmrs</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>openmrs</activeProfile>
  </activeProfiles>
  <pluginGroups>
    <pluginGroup>org.openmrs.maven.plugins</pluginGroup>
  </pluginGroups>
</settings>