Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/358.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 无法解析github maven依赖项_Java_Git_Maven_Github_Github Package Registry - Fatal编程技术网

Java 无法解析github maven依赖项

Java 无法解析github maven依赖项,java,git,maven,github,github-package-registry,Java,Git,Maven,Github,Github Package Registry,我已经成功地在GitHub()中托管了一个简单的maven依赖项。存储库当前是公共的 我现在正试图在其他项目中使用依赖关系,但我得到一个错误无法解析org.alapatbh:java sns publish:1.1-SNAPSHOT 我在~.m2/settings.xml中提供了我的凭据,如下所示: <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.

我已经成功地在GitHub()中托管了一个简单的maven依赖项。存储库当前是公共的

我现在正试图在其他项目中使用依赖关系,但我得到一个错误
无法解析org.alapatbh:java sns publish:1.1-SNAPSHOT

我在~.m2/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">

  <activeProfiles>
    <activeProfile>github</activeProfile>
  </activeProfiles>

  <profiles>
    <profile>
      <id>github</id>
      <repositories>
        <repository>
          <id>central</id>
          <url>https://repo1.maven.org/maven2</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
        <repository>
          <id>github</id>
          <name>GitHub OWNER Apache Maven Packages</name>
          <url>https://maven.pkg.github.com/alapatbh/java-sns-publish</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>

  <servers>
    <server>
      <id>github</id>
      <username>alapatbh</username>
      <password>MY_GITHUB_TOKEN</password>
    </server>
  </servers>
</settings>
<?xml version="1.0" encoding="UTF-8"?>
<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>org.example</groupId>
    <artifactId>pull-java-sns</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.alapatbh</groupId>
            <artifactId>java-sns-publish</artifactId>
            <version>1.1-SNAPSHOT</version>
        </dependency>
    </dependencies>
</project>

您是否尝试过
mvn-X…
进行调试并在输出中检查了
[DEBUG]存储库(依赖项):…
?这是调试:[DEBUG]存储库(依赖项):[central(,默认,版本+快照),github(,默认,版本+快照)][DEBUG]存储库(插件):[central的输出(,默认,releases)]我将在编辑中发布错误日志。“在中找不到org.alapatbh:java sns publish:jar:1.1-SNAPSHOT”-工件不在Maven Central上。指向404页的链接未找到。@bhanuprakash我找不到任何快照版本的工件(jar附带1.1-SNAPSHOT)。jar版本为“1.1-20201228.150548-1”你的快照版本是什么?有没有“1.1-20201228.150548-1”的工件(jar)您的回购上的版本,因此您需要在依赖项中使用1.1-20201228.150548-1。具有
SNAPSHOT
限定符的工件通常仅存在于本地Maven回购中。由回购管理器管理的远程回购中的工件通常具有扩展限定符(例如Nexus:“”)为了区分不同的人/CI系统在同一时刻部署的工件。因此,通常您总是在POM中声明<代码>……快照< /代码>版本,而RePO管理器负责向您发送最新的。我认为这是GITHUB的回购操作中的一个错误。您是否曾尝试过“代码> MVN-X…<代码>进行调试并检查<代码>?[DEBUG]存储库(依赖项):…在输出中?这是调试:[DEBUG]存储库(依赖项):[central(,默认,版本+快照),github(,默认,版本+快照)][DEBUG]存储库(插件):[central(,默认,版本)]的输出。我将在编辑中发布错误日志。“在中找不到org.alapatbh:java sns publish:jar:1.1-SNAPSHOT”-工件不在Maven Central上。找不到指向404页面的链接。@bhanuprakash我找不到任何快照版本的工件(jar附加了1.1-SNAPSHOT)。版本为“1.1-20201228.150548-1”的jar是您的快照版本吗?有什么方法只有工件吗(jar)在您的回购上使用“1.1-20201228.150548-1”版本,因此您需要在依赖项中使用1.1-20201228.150548-1。具有
SNAPSHOT
限定符的工件通常仅存在于本地Maven回购中。由回购管理器管理的远程回购中的工件通常具有扩展限定符(例如Nexus:“)为了区分不同的人/CI系统在同一时刻部署的工件。因此,通常您总是在POM中声明<代码>…快照< /代码>版本,而RePO管理器会把最新的消息发送给您。我认为这是GITHUB的回购协议中的一个错误。
[ERROR] Failed to execute goal on project pull-java-sns: Could not resolve dependencies for project org.example:pull-java-sns:jar:1.0-SNAPSHOT: 
  Failure to find org.alapatbh:java-sns-publish:jar:1.1-SNAPSHOT in https://repo1.maven.org/maven2 was cached in the local repository, 
  resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project pull-java-sns: 
  Could not resolve dependencies for project org.example:pull-java-sns:jar:1.0-SNAPSHOT: 
  Failure to find org.alapatbh:java-sns-publish:jar:1.1-SNAPSHOT in https://repo1.maven.org/maven2 was cached in the local repository, 
  resolution will not be reattempted until the update interval of central has elapsed or updates are forced
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies (LifecycleDependencyResolver.java:269)
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies (LifecycleDependencyResolver.java:147)
    at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved (MojoExecutor.java:248)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:202)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)