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>
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.