请教一个 maven deploy jar 包失败的问题 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
seedhk
V2EX    Java

请教一个 maven deploy jar 包失败的问题

  •  
  •   seedhk 2024-04-07 14:55:30 +08:00 1620 次点击
    这是一个创建于 554 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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.verion}</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> 
    10 条回复    2024-04-08 08:40:04 +08:00
    hnliuzesen
        1
    hnliuzesen  
       2024-04-07 15:02:08 +08:00
    这个 0.0.0.0:7000 的地址执行 deploy 命令的机器用浏览器能访问么?
    seedhk
        2
    seedhk  
    OP
       2024-04-07 15:07:50 +08:00
    @hnliuzesen 可以的,maven 包的下载正常
    perfectlife
        3
    perfectlife  
       2024-04-07 15:53:57 +08:00
    我还是感觉你这个 0.0.0.0:7000 这个地址比较怪
    seedhk
        4
    seedhk  
    OP
       2024-04-07 16:10:52 +08:00
    @perfectlife 原本是真实的服务器 IP 地址,被我隐藏成了 0.0.0.0
    Kaiv2
        5
    Kaiv2  
       2024-04-07 16:39:50 +08:00
    repository id 配置错误
    Kaiv2
        6
    Kaiv2  
       2024-04-07 16:41:22 +08:00
    还有,maven 好像后 3.7/ 8.xx 后面的版本必须使用 https 了
    seedhk
        7
    seedhk  
    OP
       2024-04-07 16:52:01 +08:00
    @Kaiv2 repository id 配置错误 请问具体指的是哪里。
    maven 目前用的是 3.6.1
    xuyang2
        8
    xuyang2  
       2024-04-07 17:17:33 +08:00
    maven 是开源的,
    mvn deploy 也是可以用 IDE debug 的

    https://stackoverflow.com/questions/14602540/how-to-debug-a-maven-goal-with-intellij-idea
    xiaokongwu
        9
    xiaokongwu  
       2024-04-07 17:34:09 +08:00
    多了个 ">"……

    seedhk
        10
    seedhk  
    OP
       2024-04-08 08:40:04 +08:00
    @xiaokongwu 感谢大佬,确实是。我之前也注意到了这个 > 但是只检查了 setting.xml 文件,没检查 pom 文件。
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     1045 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 28ms UTC 23:00 PVG 07:00 LAX 16:00 JFK 19:00
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86