Maven无法解析AWS-CDK依赖项(Java)

sauutmhj  于 2022-10-22  发布在  Maven
关注(0)|答案(1)|浏览(163)

我正在尝试构建一个使用AWS CDK software.amazon.awscdk包的Maven多模块项目。
但是,我总是会得到DependencyResolutionException错误:

  1. [ERROR] Failed to execute goal on project github-api-infrastructure: Could not resolve dependencies for project pixee:github-api-infrastructure:jar:dev: Failed to collect dependencies at software.amazon.awscdk:aws-cdk-lib:jar:2.17.0 -> software.constructs:constructs:jar:[10.0.0,11.0.0): No versions available for software.constructs:constructs:jar:[10.0.0,11.0.0) within specified range -> [Help 1]

错误表明它找不到具有正确版本的software.constructs包,但它是should exist on the Maven repositories
我尝试过更新我的Maven版本,清除Maven缓存并重新构建,但我得到了相同的错误。
这是唯一一个无法构建的模块,因此我不认为它会成为DependencyResolutionException文档中列出的问题,例如与远程存储库的连接配置错误或网络问题。
这个构建可以在我的队友电脑上运行,但不能在我的电脑上运行。我不确定可能是什么问题,因为我们使用的是相同的ish Java(我在17,他们有18)版本和相同的Maven版本。
不熟悉Java生态系统,如果需要进一步澄清,请告诉我。
多模块pom.xml

  1. <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">
  2. <modelVersion>4.0.0</modelVersion>
  3. <groupId>x</groupId>
  4. <artifactId>github-api</artifactId>
  5. <packaging>pom</packaging>
  6. <version>dev</version>
  7. <modules>
  8. <module>testutils</module>
  9. <module>core</module>
  10. <module>functions</module>
  11. <module>infra</module>
  12. </modules>
  13. <distributionManagement>
  14. <repository>
  15. <id>central</id>
  16. <name>x-libs-release</name>
  17. <url>https://x.jfrog.io/artifactory/mailman</url>
  18. </repository>
  19. </distributionManagement>
  20. <repositories>
  21. <repository>
  22. <id>central</id>
  23. <name>x-libs-release</name>
  24. <url>https://x.jfrog.io/artifactory/mailman</url>
  25. <snapshots>
  26. <enabled>false</enabled>
  27. </snapshots>
  28. </repository>
  29. <repository>
  30. <id>snapshots</id>
  31. <name>x-libs-snapshot</name>
  32. <url>https://x.jfrog.io/artifactory/mailman</url>
  33. <snapshots>
  34. <enabled>true</enabled>
  35. </snapshots>
  36. </repository>
  37. </repositories>
  38. <properties>
  39. <fmt.goal>format</fmt.goal>
  40. <versions.fmt-maven-plugin>2.18</versions.fmt-maven-plugin>
  41. <versions.maven-shade-plugin>3.2.4</versions.maven-shade-plugin>
  42. <versions.maven-compiler-plugin>3.8.1</versions.maven-compiler-plugin>
  43. <versions.maven-surefire-plugin>3.0.0-M4</versions.maven-surefire-plugin>
  44. <versions.maven-failsafe-plugin>2.22.0</versions.maven-failsafe-plugin>
  45. <maven.compiler.source>11</maven.compiler.source>
  46. <maven.compiler.target>11</maven.compiler.target>
  47. <versions.jackson>2.13.2</versions.jackson>
  48. <versions.log4j>2.17.1</versions.log4j>
  49. <versions.awssdk>1.12.99</versions.awssdk>
  50. <versions.junit-jupiter>5.7.0</versions.junit-jupiter>
  51. <versions.hamcrest>1.3</versions.hamcrest>
  52. <versions.mockito>4.3.1</versions.mockito>
  53. <versions.hsqldb>2.6.1</versions.hsqldb>
  54. <versions.mariadb>2.6.0</versions.mariadb>
  55. </properties>
  56. <build>
  57. <pluginManagement>
  58. <plugins>
  59. <plugin>
  60. <artifactId>maven-compiler-plugin</artifactId>
  61. <version>${versions.maven-compiler-plugin}</version>
  62. <configuration>
  63. <forceJavacCompilerUse>true</forceJavacCompilerUse>
  64. <source>${maven.compiler.source}</source>
  65. <target>${maven.compiler.target}</target>
  66. </configuration>
  67. </plugin>
  68. <plugin>
  69. <groupId>org.jacoco</groupId>
  70. <artifactId>jacoco-maven-plugin</artifactId>
  71. <version>0.8.7</version>
  72. <executions>
  73. <execution>
  74. <goals>
  75. <goal>prepare-agent</goal>
  76. </goals>
  77. </execution>
  78. <execution>
  79. <id>generate-code-coverage-report</id>
  80. <phase>test</phase>
  81. <goals>
  82. <goal>report</goal>
  83. </goals>
  84. </execution>
  85. </executions>
  86. </plugin>
  87. <plugin>
  88. <artifactId>maven-surefire-plugin</artifactId>
  89. <version>${versions.maven-surefire-plugin}</version>
  90. <configuration>
  91. <trimStackTrace>false</trimStackTrace>
  92. </configuration>
  93. </plugin>
  94. <plugin>
  95. <groupId>com.spotify.fmt</groupId>
  96. <artifactId>fmt-maven-plugin</artifactId>
  97. <version>${versions.fmt-maven-plugin}</version>
  98. <executions>
  99. <execution>
  100. <id>format-java</id>
  101. <phase>validate</phase>
  102. <goals>
  103. <goal>${fmt.goal}</goal>
  104. </goals>
  105. </execution>
  106. </executions>
  107. </plugin>
  108. <plugin>
  109. <artifactId>maven-failsafe-plugin</artifactId>
  110. <version>${versions.maven-failsafe-plugin}</version>
  111. <configuration>
  112. <includes>
  113. <include>**/IT</include>
  114. </includes>
  115. </configuration>
  116. </plugin>
  117. </plugins>
  118. </pluginManagement>
  119. </build>
  120. <profiles>
  121. <profile>
  122. <id>ci</id>
  123. <activation>
  124. <property>
  125. <name>env.CI</name>
  126. </property>
  127. </activation>
  128. <properties>
  129. <fmt.goal>check</fmt.goal>
  130. </properties>
  131. </profile>
  132. </profiles>
  133. </project>

Infra模块pom.xml(唯一出现故障的模块):

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <parent>
  6. <groupId>x</groupId>
  7. <artifactId>github-api</artifactId>
  8. <version>dev</version>
  9. </parent>
  10. <artifactId>github-api-infrastructure</artifactId>
  11. <packaging>jar</packaging>
  12. <properties>
  13. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  14. <versions.awscdk>2.17.0</versions.awscdk>
  15. <versions.constructs>10.0.91</versions.constructs>
  16. <versions.mybatis>3.3.10</versions.mybatis>
  17. </properties>
  18. <dependencies>
  19. <dependency>
  20. <groupId>x</groupId>
  21. <artifactId>github-api-core</artifactId>
  22. <version>${project.version}</version>
  23. </dependency>
  24. <dependency>
  25. <groupId>x</groupId>
  26. <artifactId>github-api-testutils</artifactId>
  27. <version>${project.version}</version>
  28. <scope>test</scope>
  29. </dependency>
  30. <dependency>
  31. <groupId>org.apache.logging.log4j</groupId>
  32. <artifactId>log4j-api</artifactId>
  33. <version>${versions.log4j}</version>
  34. </dependency>
  35. <dependency>
  36. <groupId>software.amazon.awscdk</groupId>
  37. <artifactId>aws-cdk-lib</artifactId>
  38. <version>${versions.awscdk}</version>
  39. <exclusions>
  40. <exclusion>
  41. <artifactId>jackson-core</artifactId>
  42. <groupId>com.fasterxml.jackson.core</groupId>
  43. </exclusion>
  44. <exclusion>
  45. <artifactId>jackson-databind</artifactId>
  46. <groupId>com.fasterxml.jackson.core</groupId>
  47. </exclusion>
  48. </exclusions>
  49. </dependency>
  50. <dependency>
  51. <groupId>software.constructs</groupId>
  52. <artifactId>constructs</artifactId>
  53. <version>${versions.constructs}</version>
  54. </dependency>
  55. <dependency>
  56. <groupId>org.mybatis</groupId>
  57. <artifactId>mybatis-migrations</artifactId>
  58. <version>${versions.mybatis}</version>
  59. </dependency>
  60. <dependency>
  61. <groupId>org.mariadb.jdbc</groupId>
  62. <artifactId>mariadb-java-client</artifactId>
  63. <version>${versions.mariadb}</version>
  64. </dependency>
  65. <dependency>
  66. <groupId>org.junit.jupiter</groupId>
  67. <artifactId>junit-jupiter-api</artifactId>
  68. <version>${versions.junit-jupiter}</version>
  69. <scope>test</scope>
  70. </dependency>
  71. <dependency>
  72. <groupId>org.junit.jupiter</groupId>
  73. <artifactId>junit-jupiter-params</artifactId>
  74. <version>${versions.junit-jupiter}</version>
  75. <scope>test</scope>
  76. </dependency>
  77. <dependency>
  78. <groupId>org.hamcrest</groupId>
  79. <artifactId>hamcrest-all</artifactId>
  80. <version>${versions.hamcrest}</version>
  81. <scope>test</scope>
  82. </dependency>
  83. <dependency>
  84. <groupId>org.mockito</groupId>
  85. <artifactId>mockito-core</artifactId>
  86. <version>${versions.mockito}</version>
  87. <scope>test</scope>
  88. </dependency>
  89. <dependency>
  90. <groupId>org.hsqldb</groupId>
  91. <artifactId>hsqldb</artifactId>
  92. <version>${versions.hsqldb}</version>
  93. <scope>test</scope>
  94. </dependency>
  95. </dependencies>
  96. <build>
  97. <finalName>${project.artifactId}</finalName>
  98. <pluginManagement>
  99. <plugins>
  100. <plugin>
  101. <artifactId>maven-dependency-plugin</artifactId>
  102. <executions>
  103. <execution>
  104. <id>resource-dependencies</id>
  105. <phase>compile</phase>
  106. <goals>
  107. <goal>copy</goal>
  108. </goals>
  109. <configuration>
  110. <artifactItems>
  111. <artifactItem>
  112. <groupId>x</groupId>
  113. <artifactId>github-api-functions</artifactId>
  114. <version>${parent.version}</version>
  115. <type>jar</type>
  116. <overWrite>true</overWrite>
  117. <outputDirectory>${project.build.directory}</outputDirectory>
  118. <destFileName>github-api-functions.jar</destFileName>
  119. </artifactItem>
  120. </artifactItems>
  121. </configuration>
  122. </execution>
  123. </executions>
  124. </plugin>
  125. <!-- Create a runnable JAR -->
  126. <plugin>
  127. <groupId>org.apache.maven.plugins</groupId>
  128. <artifactId>maven-shade-plugin</artifactId>
  129. <version>${versions.maven-shade-plugin}</version>
  130. <executions>
  131. <execution>
  132. <phase>package</phase>
  133. <goals>
  134. <goal>shade</goal>
  135. </goals>
  136. <configuration>
  137. <finalName>${project.artifactId}</finalName>
  138. <filters>
  139. <filter>
  140. <artifact>*:*</artifact>
  141. <excludes>
  142. <exclude>**/Log4j2Plugins.dat</exclude>
  143. <exclude>META-INF/*.SF</exclude>
  144. <exclude>META-INF/*.DSA</exclude>
  145. <exclude>META-INF/*.RSA</exclude>
  146. </excludes>
  147. </filter>
  148. </filters>
  149. </configuration>
  150. </execution>
  151. </executions>
  152. </plugin>
  153. </plugins>
  154. </pluginManagement>
  155. <plugins>
  156. <plugin>
  157. <groupId>com.spotify.fmt</groupId>
  158. <artifactId>fmt-maven-plugin</artifactId>
  159. </plugin>
  160. <plugin>
  161. <artifactId>maven-dependency-plugin</artifactId>
  162. </plugin>
  163. <plugin>
  164. <artifactId>maven-compiler-plugin</artifactId>
  165. </plugin>
  166. <plugin>
  167. <artifactId>maven-surefire-plugin</artifactId>
  168. </plugin>
  169. <plugin>
  170. <groupId>org.apache.maven.plugins</groupId>
  171. <artifactId>maven-shade-plugin</artifactId>
  172. </plugin>
  173. </plugins>
  174. </build>
  175. </project>

Maven版本:

  1. Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
  2. Maven home: /opt/maven
  3. Java version: 17.0.4, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64
  4. Default locale: en, platform encoding: UTF-8
  5. OS name: "linux", version: "5.4.72-microsoft-standard-wsl2", arch: "amd64", family: "unix"

Java版本:

  1. openjdk 17.0.4 2022-07-19
  2. OpenJDK Runtime Environment (build 17.0.4+8-Ubuntu-120.04)
  3. OpenJDK 64-Bit Server VM (build 17.0.4+8-Ubuntu-120.04, mixed mode, sharing)

我正在WSL2上运行Ubuntu 20.04.5 LTS。
更新:我昨天尝试重建它,构建成功,没有错误。我什么都没改变。也许包存储库已更新?
我今天试着重建它,但得到了和以前一样的错误。我想知道这是否是一个错误,因为Maven是如何在WSL上本地配置的。但为什么它只会影响这个方案呢?
我想现在依赖项解析失败是因为JRogs方面的问题。

jmo0nnb3

jmo0nnb31#

最后,问题是我对JFrog的权限。我被升级为管理员,在构建过程中没有再次遇到相同的错误。

相关问题