上传jcenter的“第一次”所遇到的坑

把自己的项目开源给外界或者自己的团队,使用jcenter是一个不错的选择。在bintary.com上新建项目时,如果选择私有的话,是要收费的。开源项目管理网站的惯用作法。

现在就来记录我第一次上Jcenter时所遇到的坑,过程稍有挫折,但是结果是肯定的,美好的,就像每个人的“第一次”一样的,你懂的。。

参考:http://blog.csdn.net/lmj623565791/article/details/51148825  (鸿洋,步骤略简单)

https://bintray.com/注册

第一个坑:bintray网站,去哪儿添加新项目

查到的资料里面都是在如下页面

即使jcenter、android很像,也不是要上传的maven库。点击如上链接,找到如下maven入口,然后就是add new package 新建项目了。新建页面注意Version control *为必填项,内容随意填一个github或者http://git.oschina.net/上的网址就可以了。


如下坑都是上传时使用bintray-release时编辑所报的错误。


项目根目录下gradle文件添加:
classpath 'com.novoda:bintray-release:0.3.4'

待上传module的gradle文件添加如下配置:

apply plugin: 'com.novoda.bintray-release'//上传jcenter

//上传jcenter
publish {
userOrg = 'gang'//bintray.com用户名
groupId = 'hztbc-test'//jcenter上的路径,根据自己项目自定义填写
artifactId = 'core'//项目名称
publishVersion = '1.0.0'//版本号
desc = 'Oh hi, this is a nice description for a project, right?'//描述,不重要
website = 'http://git.oschina.net/xingshen58/learn'//网站,不重要;尽量模拟github上的地址,例如我这样的;当然你有地址最好了
}
上传时执行的命令,在android studio命令窗输入

./gradlew clean build bintrayUpload -PbintrayUser=xxxx -PbintrayKey=xxxx -PdryRun=false

其中PbintrayUser和PbintrayKey需要替换成在bintray网站注册的本人信息。


第二个坑:-bash: ./gradlew: Permission denied</div>

执行命令的权限不够,先执行如下命令赋予权限:

chmod +x gradlew  回车执行后,再执行上传jcenter命令就可以了。


第三个坑:Execution failed for task ':core:lint'.

Execution failed for task ':core:lint'.
> Lint found errors in the project; aborting build.

在上传过程中执行了lint检查,所以可能会报上面的错误。解决方法就是避免lint的检查,在每个module的gradle下面就要添加如下配置:

android {
lintOptions {
abortOnError false
}
}


第四个坑:Execution failed for task ':core:mavenAndroidJavadocs'.

Execution failed for task ':core:mavenAndroidJavadocs'.
> Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '/Users/zhou/git/app/core/build/tmp/mavenAndroidJavadocs/javadoc.options'


在上传过程中执行了javadoc检查,所以可能会报上面的错误。解决方法就是避免javadoc的检查,在项目根目录下的gradle下面就要添加如下配置:

allprojects {
repositories {
jcenter()
}
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
}
}


发布了22 篇原创文章 · 获赞 3 · 访问量 3万+
展开阅读全文

android gradle工程,引用annotation包,构建javadoc报错

09-16

我在android 工程引入了android官方的注解support-annotation,然后用gradle构建时增加了一个javadoc的task,就是提取javadoc时失败,不知道怎么修改。so求助各位大神们,怎么解决? 我现在用的插件是‘com.android.tools.build:gradle:1.3.0’,gradle版本2.7 代码如下: ``` task androidJavadoc(type: Javadoc) { source = android.sourceSets.main.java.srcDirs exclude '**/pom.xml' exclude '**/proguard_annotations.pro' classpath += files(android.bootClasspath.join(File.pathSeparator)) destinationDir = file("../javadoc/") } task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { classifier = 'javadoc' from androidJavadoc.destinationDir } artifacts { archives androidSourcesJar archives androidJavadocJar } ``` 错误如下: Execution failed for task ':IPullToRefreshRecycler:androidJavadoc'. > Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '/Users/heart19901126/zhouli/codes/50AH-code-master/IPullToRefreshRecyclerSample/IPullToRefreshRecycler/build/tmp/androidJavadoc/javadoc.options' * Try: Run with --info or --debug option to get more log output. * Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':IPullToRefreshRecycler:androidJavadoc'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:305) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51) at org.gradle.execution.taskgraph.ParallelTaskPlanExecutor.process(ParallelTaskPlanExecutor.java:51) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62) at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86) at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80) at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33) at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26) at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51) at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) at org.gradle.launcher.Main.doAction(Main.java:33) at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54) at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35) at org.gradle.launcher.GradleMain.main(GradleMain.java:23) Caused by: org.gradle.api.GradleException: Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '/Users/heart19901126/zhouli/codes/50AH-code-master/IPullToRefreshRecyclerSample/IPullToRefreshRecycler/build/tmp/androidJavadoc/javadoc.options' at org.gradle.api.tasks.javadoc.internal.JavadocGenerator.execute(JavadocGenerator.java:55) at org.gradle.api.tasks.javadoc.internal.JavadocGenerator.execute(JavadocGenerator.java:31) at org.gradle.api.tasks.javadoc.Javadoc.executeExternalJavadoc(Javadoc.java:140) at org.gradle.api.tasks.javadoc.Javadoc.generate(Javadoc.java:128) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:218) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:579) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:562) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61) ... 44 more Caused by: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/bin/javadoc'' finished with non-zero exit value 1 at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:365) at org.gradle.process.internal.DefaultExecAction.execute(DefaultExecAction.java:31) at org.gradle.api.tasks.javadoc.internal.JavadocGenerator.execute(JavadocGenerator.java:52) ... 55 more 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览