第一次使用自己上传的maven库时遇到的错误总结
2016-11-21 14:00
363 查看
背景:好不容易将自己的jar包上传到maven中心,可以下载了,结果使用的时候,报各种错误。
错误1:
wudideMacBook-Pro:UCarNew xiepengchong$ ./gradlew tasks
Parallel execution with configuration on demand is an incubating feature.
Download https://repo1.maven.org/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.pom
Download https://repo1.maven.org/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.jar
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/xiepengchong/ucar_git/ucarandroid/UCarNew/build.gradle' line: 27
* What went wrong:
A problem occurred evaluating root project 'UCarNew'.
原因:原来是我的版本不对,后来将build tool版本更改了一下。gradle版本改为2.10,
* Where:Build file '/Users/xiepengchong/ucar_git/ucarandroid/UCarNew/build.gradle' line: 32
* What went wrong:A problem occurred evaluating root project 'UCarNew'.> Could not find implementation class 'com.droidtitan.lintcleaner.LintCleanerPlugin' for plugin 'com.droidtitan.lintcleaner' specified in jar:file:/Users/xiepengchong/ucar_git/ucarandroid/UCarNew/external_lib/lint-cleaner-plugin-1.0.1.jar!/META-INF/gradle-plugins/com.droidtitan.lintcleaner.properties.原因:
87 <build> 88 <sourceDirectory>src/main/groovy</sourceDirectory> 89 <resources> 90 <resource> 91 <directory>src/main/resources</directory> 92 <includes> 93 <include>**/*.*</include> 94 </includes> 95 </resource> 96 </resources>
98 <plugin> 99 <groupId>org.codehaus.gmaven</groupId>100 <artifactId>gmaven-plugin</artifactId>101 <version>1.2</version>102 <configuration>103 <providerSelection>1.7</providerSelection>104 <sourceEncoding>UTF-8</sourceEncoding>105 </configuration>106 <executions>107 <execution>108 <goals>109 <goal>generateStubs</goal>110 <goal>compile</goal>111 </goals>112 </execution>113 </executions>114 </plugin>
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project lint-cleaner-plugin: Compilation failure: Compilation failure:[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerPlugin.java:[6,1] 程序包org.gradle.api不存在[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerPlugin.java:[13,5] 找不到符号[ERROR] 符号: 类 Plugin[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerPlugin.java:[13,12] 找不到符号[ERROR] 符号: 类 Project[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerPlugin.java:[18,20] 找不到符号[ERROR] 符号: 类 Project[ERROR] 位置: 类 com.droidtitan.lintcleaner.LintCleanerPlugin[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerPluginExtension.java:[6,1] 程序包org.gradle.api不存在[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerPluginExtension.java:[14,35] 找不到符号[ERROR] 符号: 类 Project[ERROR] 位置: 类 com.droidtitan.lintcleaner.LintCleanerPluginExtension[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerTask.java:[7,1] 程序包org.gradle.api不存在[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerTask.java:[11,1] 程序包org.gradle.api.tasks不存在[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerTask.java:[15,11] 找不到符号[ERROR] 符号: 类 DefaultTask[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerTask.java:[44,28] 对NodeList的引用不明确[ERROR] groovy.util 中的类 groovy.util.NodeList 和 org.w3c.dom 中的接口 org.w3c.dom.NodeList 都匹配
58 <dependency> 59 <groupId>gradle-core</groupId> 60 <artifactId>gradle-core</artifactId> 61 <version>2.10</version> 62 <scope>system</scope> 63 <systemPath>${project.basedir}/libs/gradle-core-2.10.jar</systemPath> 64 </dependency> 65 <dependency> 66 <groupId>gradle-base-services-groovy</groupId> 67 <artifactId>gradle-base-services-groovy</artifactId> 68 <version>2.10</version> 69 <scope>system</scope> 70 <systemPath>${project.basedir}/libs/gradle-base-services-groovy-2.10.jar</systemPath> 71 </dependency> 72 <dependency> 73 <groupId>gradle-base-services</groupId> 74 <artifactId>gradle-base-services</artifactId> 75 <version>2.10</version> 76 <scope>system</scope> 77 <systemPath>${project.basedir}/libs/gradle-base-services-2.10.jar</systemPath> 78 </dependency> 79 <dependency> 80 <groupId>gradle-model-core</groupId> 81 <artifactId>gradle-model-core</artifactId> 82 <version>2.10</version> 83 <scope>system</scope> 84 <systemPath>${project.basedir}/libs/gradle-model-core-2.10.jar</systemPath> 85 </dependency>
115 <plugin>116 <groupId>org.apache.maven.plugins</groupId>117 <artifactId>maven-source-plugin</artifactId>118 <version>2.4</version>119 <configuration>120 <attach>true</attach>121 </configuration>122 <executions>123 <execution>124 <id>attach-sources</id>125 <phase>package</phase>126 <goals>127 <goal>jar-no-fork</goal>128 </goals>129 </execution>130 </executions>131 </plugin>132 <plugin>133 <groupId>org.apache.maven.plugins</groupId>134 <artifactId>maven-javadoc-plugin</artifactId>135 <version>2.10.2</version>136 <configuration>137 <aggregate>true</aggregate>138 </configuration>139 <executions>140 <execution>141 <id>attach-javadocs</id>142 <goals>143 <goal>jar</goal>144 </goals>145 </execution>146 </executions>147 </plugin>
错误1:
wudideMacBook-Pro:UCarNew xiepengchong$ ./gradlew tasks
Parallel execution with configuration on demand is an incubating feature.
Download https://repo1.maven.org/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.pom
Download https://repo1.maven.org/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.jar
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/xiepengchong/ucar_git/ucarandroid/UCarNew/build.gradle' line: 27
* What went wrong:
A problem occurred evaluating root project 'UCarNew'.
原因:原来是我的版本不对,后来将build tool版本更改了一下。gradle版本改为2.10,
classpath 'com.android.tools.build:gradle:2.1.2'
错误2:
* Where:Build file '/Users/xiepengchong/ucar_git/ucarandroid/UCarNew/build.gradle' line: 32
* What went wrong:A problem occurred evaluating root project 'UCarNew'.> Could not find implementation class 'com.droidtitan.lintcleaner.LintCleanerPlugin' for plugin 'com.droidtitan.lintcleaner' specified in jar:file:/Users/xiepengchong/ucar_git/ucarandroid/UCarNew/external_lib/lint-cleaner-plugin-1.0.1.jar!/META-INF/gradle-plugins/com.droidtitan.lintcleaner.properties.原因:
我上传的jar包中,没有class文件,原来我的工程是使用groovy写的,所以有一些东西和java的不同,所以需要单独配置。
在pom.xml中指定路径
87 <build> 88 <sourceDirectory>src/main/groovy</sourceDirectory> 89 <resources> 90 <resource> 91 <directory>src/main/resources</directory> 92 <includes> 93 <include>**/*.*</include> 94 </includes> 95 </resource> 96 </resources>
错误:指定之后,还需要使之可以编译进去,需要在pom.xml中配置下面的信息mvn compile
98 <plugin> 99 <groupId>org.codehaus.gmaven</groupId>100 <artifactId>gmaven-plugin</artifactId>101 <version>1.2</version>102 <configuration>103 <providerSelection>1.7</providerSelection>104 <sourceEncoding>UTF-8</sourceEncoding>105 </configuration>106 <executions>107 <execution>108 <goals>109 <goal>generateStubs</goal>110 <goal>compile</goal>111 </goals>112 </execution>113 </executions>114 </plugin>
错误:编译的时候,各种路径找不到
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project lint-cleaner-plugin: Compilation failure: Compilation failure:[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerPlugin.java:[6,1] 程序包org.gradle.api不存在[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerPlugin.java:[13,5] 找不到符号[ERROR] 符号: 类 Plugin[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerPlugin.java:[13,12] 找不到符号[ERROR] 符号: 类 Project[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerPlugin.java:[18,20] 找不到符号[ERROR] 符号: 类 Project[ERROR] 位置: 类 com.droidtitan.lintcleaner.LintCleanerPlugin[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerPluginExtension.java:[6,1] 程序包org.gradle.api不存在[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerPluginExtension.java:[14,35] 找不到符号[ERROR] 符号: 类 Project[ERROR] 位置: 类 com.droidtitan.lintcleaner.LintCleanerPluginExtension[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerTask.java:[7,1] 程序包org.gradle.api不存在[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerTask.java:[11,1] 程序包org.gradle.api.tasks不存在[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerTask.java:[15,11] 找不到符号[ERROR] 符号: 类 DefaultTask[ERROR] /Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/generated-sources/groovy-stubs/main/com/droidtitan/lintcleaner/LintCleanerTask.java:[44,28] 对NodeList的引用不明确[ERROR] groovy.util 中的类 groovy.util.NodeList 和 org.w3c.dom 中的接口 org.w3c.dom.NodeList 都匹配
原因:我们使用gradle编译,系统下好多jar都是配置好的,如果用maven编译,则需要指定,在pom.xml指定我们本地以来jar文件
58 <dependency> 59 <groupId>gradle-core</groupId> 60 <artifactId>gradle-core</artifactId> 61 <version>2.10</version> 62 <scope>system</scope> 63 <systemPath>${project.basedir}/libs/gradle-core-2.10.jar</systemPath> 64 </dependency> 65 <dependency> 66 <groupId>gradle-base-services-groovy</groupId> 67 <artifactId>gradle-base-services-groovy</artifactId> 68 <version>2.10</version> 69 <scope>system</scope> 70 <systemPath>${project.basedir}/libs/gradle-base-services-groovy-2.10.jar</systemPath> 71 </dependency> 72 <dependency> 73 <groupId>gradle-base-services</groupId> 74 <artifactId>gradle-base-services</artifactId> 75 <version>2.10</version> 76 <scope>system</scope> 77 <systemPath>${project.basedir}/libs/gradle-base-services-2.10.jar</systemPath> 78 </dependency> 79 <dependency> 80 <groupId>gradle-model-core</groupId> 81 <artifactId>gradle-model-core</artifactId> 82 <version>2.10</version> 83 <scope>system</scope> 84 <systemPath>${project.basedir}/libs/gradle-model-core-2.10.jar</systemPath> 85 </dependency>
错误:一切都结束了,但是发现我们部署的时候,没有上传javadoc和source,所以部署的时候,会有问题。
原因:同样需要在build的时候,配置plugin
115 <plugin>116 <groupId>org.apache.maven.plugins</groupId>117 <artifactId>maven-source-plugin</artifactId>118 <version>2.4</version>119 <configuration>120 <attach>true</attach>121 </configuration>122 <executions>123 <execution>124 <id>attach-sources</id>125 <phase>package</phase>126 <goals>127 <goal>jar-no-fork</goal>128 </goals>129 </execution>130 </executions>131 </plugin>132 <plugin>133 <groupId>org.apache.maven.plugins</groupId>134 <artifactId>maven-javadoc-plugin</artifactId>135 <version>2.10.2</version>136 <configuration>137 <aggregate>true</aggregate>138 </configuration>139 <executions>140 <execution>141 <id>attach-javadocs</id>142 <goals>143 <goal>jar</goal>144 </goals>145 </execution>146 </executions>147 </plugin>
这回上传就等待审核吧。
相关文章推荐
- gitlab使用过程中遇到大文件上传或下载失败的问题,总结一下
- 新手第一次使用python爬取豆瓣电影top250遇到的错误
- 使用uploadify上传插件时遇到 NetworkError: 403 Forbidden http://xxxx/xxxx/ 错误
- 打包上传时遇到的各种错误总结
- 新手(自己)使用Xcode上传到git@osc遇到的一些问题
- 在使用Struts时遇到的各种错误总结
- 正则表达式使用总结--记录项目中遇到的自己未解决的正则
- ASP 在Windows 2003 server使用纯代码上传大文件遇到的错误,及解决方法
- 第一次使用theos自己遇到的坑
- 在类文件中使用Response,今天又遇到同样的错误。
- 在使用WeifenLuo Suite时遇到的问题,自己记录一下,备忘
- 使用WebClient上传文件时的错误问题解决
- 使用Spring、Hibernate、Struts的一些错误总结(不断补充)
- 关于在neoshine linux下使用电视卡遇到的问题和总结
- 第一次自己总结WebService
- 使用Spring、Hibernate、Struts的一些错误总结(不断补充) (转)
- 关于我使用spring mvc框架做文件上传时遇到的问题
- 使用ASP.NET网站管理工具出现“遇到错误”
- 在使用ASP.NET网站管理工具出现“遇到错误。请返回上一页并重试。”的解决办法!
- 使用Ajax.net遇到的问题-使用会话时提示错误"只有在配置文件或 Page 指令中将启用会话状态设置为真时,才可以使用会话状态