idea 版本:2023.3.2 maven 版本:3.6.1
自己通过 nexus+docker 在服务器上搭了一个 maven 私服,想把自己的依赖包 deploy 到私服上,出现了如下错误:
报错信息:
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
role: org.apache.maven.wagon.Wagon
roleHint: >http
at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:267)
at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:255)
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0:deploy-file (deploy-file) on project by-framework: Failed to deploy artifacts/metadata: Cannot access >http://0.0.0.0:7000/repository/maven-snapshots/ with type default using the available connector factories: BasicRepositoryConnectorFactory: Cannot access >http://0.0.0.0:7000/repository/maven-snapshots/ using the registered transporter factories: WagonTransporterFactory: java.util.NoSuchElementException
[ERROR] role: org.apache.maven.wagon.Wagon
[ERROR] roleHint: >http
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0:deploy-file (deploy-file) on project by-framework: Failed to deploy artifacts/metadata: Cannot access >http://0.0.0.0:7000/repository/maven-snapshots/ with type default using the available connector factories: BasicRepositoryConnectorFactory
Caused by: org.eclipse.aether.transfer.NoRepositoryConnectorException: Cannot access >http://0.0.0.0:7000/repository/maven-snapshots/ with type default using the available connector factories: BasicRepositoryConnectorFactory
Caused by: java.util.NoSuchElementException
at org.eclipse.sisu.plexus.RealmFilteredBeans$FilteredItr.next (RealmFilteredBeans.java:118)
at org.eclipse.sisu.plexus.RealmFilteredBeans$FilteredItr.next (RealmFilteredBeans.java:1)
at org.eclipse.sisu.plexus.DefaultPlexusBeans$Itr.next (DefaultPlexusBeans.java:76)
at org.eclipse.sisu.plexus.DefaultPlexusBeans$Itr.next (DefaultPlexusBeans.java:1)
包信息:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.7</version>
<relativePath/>
</parent>
<groupId>com.xxxxx</groupId>
<artifactId>framework</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>framework</name>
依赖: .....省略业务依赖
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
<version>2.0.0</version>
</dependency>
pom 文件的配置项:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<fork>true</fork>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
<execution>
<id>deploy-file</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<repositoryId>${project.distributionManagement.snapshotRepository.id}</repositoryId>
<url>${project.distributionManagement.snapshotRepository.url}</url>
<file>${project.build.directory}/${project.build.finalName}.jar</file>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>artifactory-releases</name>
<url>http://0.0.0.0::7000/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>artifactory-snapshots</name>
<url>>http://0.0.0.0:7000/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>maven-releases</id>
<name>User Porject Release</name>
<url>http://0.0.0.0:7000/repository/maven-releases/</url>
</repository>
<repository>
<id>maven-snapshots</id>
<name>User Porject Snapshot</name>
<url>http://0.0.0.0:7000/repository/maven-snapshots/</url>
</repository>
</repositories>
maven 的 setting.xml 文件配置:
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>****</password>
</server>
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>****</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>****</password>
</server>
</servers>
<mirrors>
<mirror>
<id>mymaven</id>
<name>my maven</name>
<url>http://0.0.0.0:7000/repository/maven-public/</url>
<mirrorOf>*</mirrorOf>
</mirror>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>release</id>
<url>http://0.0.0.0:7000/repository/maven-releases/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
<repository>
<id>snapshot</id>
<url> http://0.0.0.0:7000/repository/maven-snapshots/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>release</id>
<url>http://0.0.0.0:7000/repository/maven-releases/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>snapshot</id>
<url> http://0.0.0.0:7000/repository/maven-snapshots/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
1
hnliuzesen 230 天前
这个 0.0.0.0:7000 的地址执行 deploy 命令的机器用浏览器能访问么?
|
2
seedhk OP @hnliuzesen 可以的,maven 包的下载正常
|
3
perfectlife 230 天前
我还是感觉你这个 0.0.0.0:7000 这个地址比较怪
|
4
seedhk OP @perfectlife 原本是真实的服务器 IP 地址,被我隐藏成了 0.0.0.0
|
5
Kaiv2 230 天前
repository id 配置错误
|
6
Kaiv2 230 天前
还有,maven 好像后 3.7/ 8.xx 后面的版本必须使用 https 了
|
8
xuyang2 230 天前
maven 是开源的,
mvn deploy 也是可以用 IDE debug 的 https://stackoverflow.com/questions/14602540/how-to-debug-a-maven-goal-with-intellij-idea |
9
xiaokongwu 230 天前
|
10
seedhk OP @xiaokongwu 感谢大佬,确实是。我之前也注意到了这个 > 但是只检查了 setting.xml 文件,没检查 pom 文件。
|