最近写了个项目统计的 Maven2 插件,发布到 Java.net 的 Maven2 库时遇到异常:
- daniel@daniel-laptop:~/Work/Sources/Java/maven-statistic-plugin$ mvn deploy
- [INFO] Scanning for projects...
- -----------------------------------------------------
- this realm = plexus.core.child-container[extensions]
- urls[0] = file:/home/daniel/.m2/repository/org/codehaus/plexus/plexus-utils/1.4.1/plexus-utils-1.4.1.jar
- urls[1] = file:/home/daniel/.m2/repository/org/jvnet/wagon-svn/wagon-svn/1.9-SNAPSHOT/wagon-svn-1.9-SNAPSHOT.jar
- urls[2] = file:/home/daniel/.m2/repository/org/jvnet/hudson/svnkit/svnkit/1.1.4-hudson-4/svnkit-1.1.4-hudson-4.jar
- urls[3] = file:/home/daniel/.m2/repository/ch/ethz/ganymed/ganymed-ssh2/build210/ganymed-ssh2-build210.jar
- Number of imports: 0
- this realm = plexus.core
- urls[0] = file:/usr/share/maven2/lib/wagon-ssh-common.jar
- urls[1] = file:/usr/share/maven2/lib/commons-cli.jar
- urls[2] = file:/usr/share/maven2/lib/plexus-container-default.jar
- urls[3] = file:/usr/share/maven2/lib/plexus-interactivity-api.jar
- urls[4] = file:/usr/share/maven2/lib/wagon-ssh.jar
- urls[5] = file:/usr/share/maven2/lib/maven2.jar
- urls[6] = file:/usr/share/maven2/lib/jtidy.jar
- urls[7] = file:/usr/share/maven2/lib/plexus-utils.jar
- urls[8] = file:/usr/share/maven2/lib/doxia-sink-api.jar
- urls[9] = file:/usr/share/maven2/lib/wagon-http-shared.jar
- urls[10] = file:/usr/share/maven2/lib/jsch.jar
- urls[11] = file:/usr/share/maven2/lib/wagon-file.jar
- urls[12] = file:/usr/share/maven2/lib/wagon-http-lightweight.jar
- urls[13] = file:/usr/share/maven2/lib/xml-apis.jar
- urls[14] = file:/usr/share/maven2/lib/wagon-ssh-external.jar
- urls[15] = file:/usr/share/maven2/lib/wagon-provider-api.jar
- Number of imports: 0
- -----------------------------------------------------
- [INFO] ------------------------------------------------------------------------
- [INFO] Building Statistic
- [INFO] task-segment: [deploy]
- [INFO] ------------------------------------------------------------------------
- [INFO] [plugin:descriptor]
- [INFO] Using 2 extractors.
- [INFO] Applying extractor for language: Java
- [INFO] Extractor for language: Java found 4 mojo descriptors.
- [INFO] Applying extractor for language: bsh
- [INFO] Extractor for language: bsh found 0 mojo descriptors.
- [INFO] [resources:resources]
- [INFO] Using default encoding to copy filtered resources.
- [INFO] [compiler:compile]
- [INFO] Nothing to compile - all classes are up to date
- [INFO] [resources:testResources]
- [INFO] Using default encoding to copy filtered resources.
- [INFO] [compiler:testCompile]
- [INFO] Nothing to compile - all classes are up to date
- [INFO] [surefire:test]
- [INFO] Surefire report directory: /home/daniel/Work/Sources/Java/maven-statistic-plugin/target/surefire-reports
- -------------------------------------------------------
- T E S T S
- -------------------------------------------------------
- Running net.java.dev.statistic.CssSourceStatisticMojoTest
- execute
- -----------------
- CSS Source File Count: 1
- White Lines: 7
- Comment Lines: 20
- Normal Lines: 65
- Total: 92
- -----------------
- Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.119 sec
- Running net.java.dev.statistic.JavaSourceStatisticMojoTest
- execute
- -----------------
- Java Source File Count: 2
- White Lines: 3
- Comment Lines: 42
- Normal Lines: 9
- Total: 54
- -----------------
- Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.038 sec
- Running net.java.dev.statistic.XhtmlSourceStatisticMojoTest
- execute
- -----------------
- XHTML Source File Count: 2
- White Lines: 9
- Comment Lines: 0
- Normal Lines: 63
- Total: 72
- -----------------
- Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.037 sec
- Running net.java.dev.statistic.PackageStatisticMojoTest
- execute
- -----------------
- Java Non Empty Package Count: 2
- Java Empty Package Count: 3
- Java Empty Package Path:
- src/test/java/net/java/dev/statistic/project/main/java/package3/emptypackage1
- src/test/java/net/java/dev/statistic/project/main/java/package2/emptypackage2
- src/test/java/net/java/dev/statistic/project/main/java/package1/package1_1/emptypackage3
- All Java Package Count: 5
- -----------------
- Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.024 sec
- Results :
- Tests run: 4, Failures: 0, Errors: 0, Skipped: 0
- [INFO] [jar:jar]
- [INFO] Building jar: /home/daniel/Work/Sources/Java/maven-statistic-plugin/target/maven-statistic-plugin-0.0.1.jar
- [INFO] [plugin:addPluginArtifactMetadata]
- [INFO] [install:install]
- [INFO] Installing /home/daniel/Work/Sources/Java/maven-statistic-plugin/target/maven-statistic-plugin-0.0.1.jar to /home/daniel/.m2/repository/net/java/dev/maven-statistic-plugin/0.0.1/maven-statistic-plugin-0.0.1.jar
- [INFO] [plugin:updateRegistry]
- [INFO] [deploy:deploy]
- altDeploymentRepository = null
- [INFO] ------------------------------------------------------------------------
- [ERROR] BUILD ERROR
- [INFO] ------------------------------------------------------------------------
- [INFO] Error deploying artifact: Unsupported Protocol: 'java-net': Cannot find wagon which supports the requested protocol: java-net
- Component descriptor cannot be found in the component repository: org.apache.maven.wagon.Wagonjava-net.
- [INFO] ------------------------------------------------------------------------
- [INFO] For more information, run Maven with the -e switch
- [INFO] ------------------------------------------------------------------------
- [INFO] Total time: 8 seconds
- [INFO] Finished at: Fri Dec 12 21:26:17 CST 2008
- [INFO] Final Memory: 13M/24M
- [INFO] ------------------------------------------------------------------------
原因是 Ubuntu (Debian 系统)里打包了 libwagon-java,请到 apache 下载正式的 Maven,运行 mvn 时指定使用 apache maven 的 path 就可以了 :-)