请教一个 maven deploy jar 包失败的问题 - V2EX
seedhk
V2EX    Java

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

  •  
  •   seedhk Apr 7, 2024 3271 views
    This topic created in 765 days ago, the information mentioned may be changed or developed.

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

    https://stackoverflow.com/questions/14602540/how-to-debug-a-maven-goal-with-intellij-idea
    xiaokongwu
        9
    xiaokongwu  
       Apr 7, 2024
    多了个 ">"……

    seedhk
        10
    seedhk  
    OP
       Apr 8, 2024
    @xiaokongwu 感谢大佬,确实是。我之前也注意到了这个 > 但是只检查了 setting.xml 文件,没检查 pom 文件。
    About     Help     Advertise     Blog     API     FAQ     Solana     3604 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 50ms UTC 04:49 PVG 12:49 LAX 21:49 JFK 00:49
    Do have faith in what you're doing.
    ubao msn 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