Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何将本地.jar文件依赖项添加到远程存储库?_Java_Eclipse_Maven_Groovy_Gradle - Fatal编程技术网

Java 如何将本地.jar文件依赖项添加到远程存储库?

Java 如何将本地.jar文件依赖项添加到远程存储库?,java,eclipse,maven,groovy,gradle,Java,Eclipse,Maven,Groovy,Gradle,我正在尝试使用gradle将.jar文件添加到远程存储库。在阅读了问题和描述的步骤后,我提出了以下build.gradle文件: // First, apply the publishing plugin buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "com.gradle.publish:

我正在尝试使用gradle将.jar文件添加到远程存储库。在阅读了问题和描述的步骤后,我提出了以下build.gradle文件:

// First, apply the publishing plugin
buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "com.gradle.publish:plugin-publish-plugin:0.9.1"
  }
}

apply plugin: "com.gradle.plugin-publish"
// Apply other plugins here, e.g. java plugin for a plugin written in java or
// the groovy plugin for a plugin written in groovy
apply plugin: "java"
// If your plugin has any external java dependencies, Gradle will attempt to
// downloaded them from JCenter for anyone using the plugins DSL
// so you should probably use JCenter for dependency resolution in your own
// project.
repositories {
  jcenter()
}

dependencies {
  compile gradleApi()
  compile localGroovy() //not needed for Java plugins
  // other dependencies that your plugin requires
  compile fileTree(dir: "/usr/lib/jvm/java-8-jdk/jre/lib/", include: ["*.jar"])
  compile fileTree(dir: "/home/kiara/AppLab/KIARA/kiaragen/lib/", include: ["*.jar"])
}

// Unless overridden in the pluginBundle config DSL, the project version will
// be used as your plugin version when publishing
version = "0.1.0"
group = "org.fiware.kiara.kiaragen"

// The configuration example below shows the minimum required properties
// configured to publish your plugin to the plugin portal
pluginBundle {
  credentials {
    username "Sebi"
    password "**************"
  }
  url = "https://plugins.gradle.org"
  description = "kiaragen 0.1.0"
  tags = ["fiware", "kiara", "kiaragen"]

  plugins {
    kiaragenPlugin {
      id = "org.fiware.kiara.generator.kiaragen"
      displayName = "kiaragen 0.1.0"
    }
  }
}
我要发布的.jar文件是:

/usr/local/bin/kiaragen-0.1.0.jar
当我尝试发布插件(kiaragen-0.1.0.jar)时,我得到以下错误:

$ gradle publishPlugins

FAILURE: Build failed with an exception.

* Where:
Build file '/home/kiara/AppLab/KIARA/Uploadkiaragen/build.gradle' line: 42

* What went wrong:
A problem occurred evaluating root project 'Uploadkiaragen'.
> Could not find method credentials() for arguments [build_4zc9ztisu145lwynn3m693mcz$_run_closure3_closure4@430b2699] on root project 'Uploadkiaragen'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED
当我删除凭据属性时,我得到:

$ gradle publishPlugins

FAILURE: Build failed with an exception.

* Where:
Build file '/home/kiara/AppLab/KIARA/Uploadkiaragen/build.gradle' line: 43

* What went wrong:
A problem occurred evaluating root project 'Uploadkiaragen'.
> No such property: url for class: com.gradle.publish.PluginBundleExtension

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED
我不太清楚此时发生了什么:gradle是尝试发布发布插件还是使用发布插件发布我的插件

编辑:

我已将build.gradlepluginBundle部分修改为:

// The configuration example below shows the minimum required properties
// configured to publish your plugin to the plugin portal
pluginBundle {

  website = "http://www.gradle.org/"
  vcsUrl = "https://github.com/gradle/gradle"
  description = "kiaragen 0.1.0"
  tags = ["fiware", "kiara", "kiaragen"]

  plugins {
    kiaragenPlugin {
      id = "org.fiware.kiara.generator.kiaragen"
      displayName = "kiaragen 0.1.0"
    }
  }
}
发布操作现在返回:

$ gradle publishPlugins

FAILURE: Build failed with an exception.

* Where:
Build file '/home/kiara/AppLab/KIARA/Uploadkiaragen/build.gradle' line: 43

* What went wrong:
A problem occurred evaluating root project 'Uploadkiaragen'.
> No such property: url for class: com.gradle.publish.PluginBundleExtension

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6.688 secs
[kiara@kiara Uploadkiaragen]$ gradle publishPlugins
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar
:publishPluginJar
:javadoc UP-TO-DATE
:publishPluginJavaDocsJar
:publishPlugins FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':publishPlugins'.
> No plugin descriptor for plugin ID 'org.fiware.kiara.generator.kiaragen'.
  Create a 'META-INF/gradle-plugins/org.fiware.kiara.generator.kiaragen.properties' file with a 'implementation-class' property pointing to the plugin class implementation.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED
为什么我需要:

Create a 'META-INF/gradle-plugins/org.fiware.kiara.generator.kiaragen.properties' file with a 'implementation-class' property pointing to the plugin class implementation.

当我只想上传一个.jar文件时?

你想发布一个gradle插件?不,只需上传一个.jar文件及其所有依赖项:我很困惑。那是你发布gradle插件的地方。。。但是你说你不想发表一篇对不起,我是说是的。我的插件由一个.jar文件及其依赖项组成。你想发布一个gradle插件吗?不,只需在这里上传一个.jar文件及其所有依赖项:我很困惑。那是你发布gradle插件的地方。。。但是你说你不想发表一篇对不起,我是说是的。我的插件由一个.jar文件及其依赖项组成。