D 的个人博客

但行好事莫问前程

  menu
417 文章
3446695 浏览
4 当前访客
ღゝ◡╹)ノ❤️

Ubuntu 下发布 Maven2 Plugin 到 Java.net Maven2 Repositoty

最近写了个项目统计的 Maven2 插件,发布到 Java.net 的 Maven2 库时遇到异常:

  1. daniel@daniel-laptop:~/Work/Sources/Java/maven-statistic-plugin$ mvn deploy 
  2. [INFO] Scanning for projects...
  3. -----------------------------------------------------
  4. this realm = plexus.core.child-container[extensions]
  5. urls[0] = file:/home/daniel/.m2/repository/org/codehaus/plexus/plexus-utils/1.4.1/plexus-utils-1.4.1.jar
  6. urls[1] = file:/home/daniel/.m2/repository/org/jvnet/wagon-svn/wagon-svn/1.9-SNAPSHOT/wagon-svn-1.9-SNAPSHOT.jar
  7. urls[2] = file:/home/daniel/.m2/repository/org/jvnet/hudson/svnkit/svnkit/1.1.4-hudson-4/svnkit-1.1.4-hudson-4.jar
  8. urls[3] = file:/home/daniel/.m2/repository/ch/ethz/ganymed/ganymed-ssh2/build210/ganymed-ssh2-build210.jar
  9. Number of imports: 0
  10. this realm = plexus.core
  11. urls[0] = file:/usr/share/maven2/lib/wagon-ssh-common.jar
  12. urls[1] = file:/usr/share/maven2/lib/commons-cli.jar
  13. urls[2] = file:/usr/share/maven2/lib/plexus-container-default.jar
  14. urls[3] = file:/usr/share/maven2/lib/plexus-interactivity-api.jar
  15. urls[4] = file:/usr/share/maven2/lib/wagon-ssh.jar
  16. urls[5] = file:/usr/share/maven2/lib/maven2.jar
  17. urls[6] = file:/usr/share/maven2/lib/jtidy.jar
  18. urls[7] = file:/usr/share/maven2/lib/plexus-utils.jar
  19. urls[8] = file:/usr/share/maven2/lib/doxia-sink-api.jar
  20. urls[9] = file:/usr/share/maven2/lib/wagon-http-shared.jar
  21. urls[10] = file:/usr/share/maven2/lib/jsch.jar
  22. urls[11] = file:/usr/share/maven2/lib/wagon-file.jar
  23. urls[12] = file:/usr/share/maven2/lib/wagon-http-lightweight.jar
  24. urls[13] = file:/usr/share/maven2/lib/xml-apis.jar
  25. urls[14] = file:/usr/share/maven2/lib/wagon-ssh-external.jar
  26. urls[15] = file:/usr/share/maven2/lib/wagon-provider-api.jar
  27. Number of imports: 0
  28. -----------------------------------------------------
  29. [INFO] ------------------------------------------------------------------------
  30. [INFO] Building Statistic
  31. [INFO]    task-segment: [deploy]
  32. [INFO] ------------------------------------------------------------------------
  33. [INFO] [plugin:descriptor]
  34. [INFO] Using 2 extractors.
  35. [INFO] Applying extractor for language: Java
  36. [INFO] Extractor for language: Java found 4 mojo descriptors.
  37. [INFO] Applying extractor for language: bsh
  38. [INFO] Extractor for language: bsh found 0 mojo descriptors.
  39. [INFO] [resources:resources]
  40. [INFO] Using default encoding to copy filtered resources.
  41. [INFO] [compiler:compile]
  42. [INFO] Nothing to compile - all classes are up to date
  43. [INFO] [resources:testResources]
  44. [INFO] Using default encoding to copy filtered resources.
  45. [INFO] [compiler:testCompile]
  46. [INFO] Nothing to compile - all classes are up to date
  47. [INFO] [surefire:test]
  48. [INFO] Surefire report directory: /home/daniel/Work/Sources/Java/maven-statistic-plugin/target/surefire-reports
  49. -------------------------------------------------------
  50.  T E S T S
  51. -------------------------------------------------------
  52. Running net.java.dev.statistic.CssSourceStatisticMojoTest
  53. execute
  54. -----------------
  55. CSS Source File Count: 1
  56. White Lines: 7
  57. Comment Lines: 20
  58. Normal Lines: 65
  59. Total: 92
  60. -----------------
  61. Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.119 sec
  62. Running net.java.dev.statistic.JavaSourceStatisticMojoTest
  63. execute
  64. -----------------
  65. Java Source File Count: 2
  66. White Lines: 3
  67. Comment Lines: 42
  68. Normal Lines: 9
  69. Total: 54
  70. -----------------
  71. Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.038 sec
  72. Running net.java.dev.statistic.XhtmlSourceStatisticMojoTest
  73. execute
  74. -----------------
  75. XHTML Source File Count: 2
  76. White Lines: 9
  77. Comment Lines: 0
  78. Normal Lines: 63
  79. Total: 72
  80. -----------------
  81. Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.037 sec
  82. Running net.java.dev.statistic.PackageStatisticMojoTest
  83. execute
  84. -----------------
  85. Java Non Empty Package Count: 2
  86. Java Empty Package Count: 3
  87. Java Empty Package Path: 
  88.     src/test/java/net/java/dev/statistic/project/main/java/package3/emptypackage1
  89.     src/test/java/net/java/dev/statistic/project/main/java/package2/emptypackage2
  90.     src/test/java/net/java/dev/statistic/project/main/java/package1/package1_1/emptypackage3
  91. All Java Package Count: 5
  92. -----------------
  93. Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.024 sec
  94. Results :
  95. Tests run: 4, Failures: 0, Errors: 0, Skipped: 0
  96. [INFO] [jar:jar]
  97. [INFO] Building jar: /home/daniel/Work/Sources/Java/maven-statistic-plugin/target/maven-statistic-plugin-0.0.1.jar
  98. [INFO] [plugin:addPluginArtifactMetadata]
  99. [INFO] [install:install]
  100. [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
  101. [INFO] [plugin:updateRegistry]
  102. [INFO] [deploy:deploy]
  103. altDeploymentRepository = null
  104. [INFO] ------------------------------------------------------------------------
  105. [ERROR] BUILD ERROR
  106. [INFO] ------------------------------------------------------------------------
  107. [INFO] Error deploying artifact: Unsupported Protocol: 'java-net': Cannot find wagon which supports the requested protocol: java-net
  108. Component descriptor cannot be found in the component repository: org.apache.maven.wagon.Wagonjava-net.
  109. [INFO] ------------------------------------------------------------------------
  110. [INFO] For more information, run Maven with the -e switch
  111. [INFO] ------------------------------------------------------------------------
  112. [INFO] Total time: 8 seconds
  113. [INFO] Finished at: Fri Dec 12 21:26:17 CST 2008
  114. [INFO] Final Memory: 13M/24M
  115. [INFO] ------------------------------------------------------------------------


原因是 Ubuntu (Debian 系统)里打包了 libwagon-java,请到 apache 下载正式的 Maven,运行 mvn 时指定使用 apache maven 的 path 就可以了 :-)