简体   繁体   English

如何从Maven Central安装?

[英]How do I install from Maven Central?

I'm trying to install this but I'm unfamiliar with Maven and I have no idea how to follow the installation instructions: https://github.com/twosigma/flint (it's one of those "so basic nobody bothers to state it on the internet" questions) 我正在尝试安装此软件,但我不熟悉Maven,而且我也不知道如何遵循安装说明: https : //github.com/twosigma/flint (这是“这样的基础之一,因此基本没有人打扰说它”在互联网上”的问题)

According to that link "Scala artifact is published in maven central" - so how do I get that thing installed where Spark (and ultimately pyspark) can use it? 根据该链接“ Scala工件在Maven Central中发布”-那么如何在Spark(最终是pyspark)可以使用它的地方安装该东西?

For apt it would just be apt-get install xyz 对于apt来说,就是apt-get install xyz
For pip it would just be pip install xyz 对于pip,只需pip install xyz

so why isn't mvn install flint working for me? 那为什么mvn install flint对我不起作用?

Add the dependencies to your Maven project's pom.xml (if you have a project): 依赖项添加到您的Maven项目的pom.xml (如果您有一个项目):

<dependency>
    <groupId>com.twosigma</groupId>
    <artifactId>flint</artifactId>
    <version>0.6.0</version>
</dependency>

or download the jar (linked from the above link) or from here (click "Browse" or "Downloads"). 或下载jar (通过上面的链接链接)或从此处下载(单击“浏览”或“下载”)。

I don't know Spark or Scala. 我不知道Spark或Scala。 Maybe there is more convenient way to get it via dependencies. 也许有一种更便捷的方法可以通过依赖来获取它。

The point is that you do not install Maven dependencies. 关键是您不安装Maven依赖项。

You just add them to your pom.xml (when doing Maven) or the appropriate build file (eg build.gradle ). 您只需将它们添加到pom.xml (在执行Maven时)或适当的构建文件(例如build.gradle )中。 Then they are downloaded automatically from MavenCentral (or any other configured repository), as soon as you build. 然后,一旦您构建,它们就会自动从MavenCentral(或任何其他配置的存储库)下载。

For the "How do I add them", I refer to the answer of @Freddy. 对于“如何添加它们”,请参阅@Freddy的答案。

In the corporate world you would need to find your Maven proxy's repository_url , ask for Nexus or Artifactory with the Java developers. 在企业界,您需要找到Maven代理的repository_url ,并向Java开发人员寻求Nexus或Artifactory。

Then know that you can install all kinds of jvm software published in Maven Central and other configured repositories without using Maven, or Java. 然后知道您可以安装在Maven Central和其他配置的存储库中发布的所有jvm软件,而无需使用Maven或Java。 As long as you know the Maven properties of the application artifacts. 只要您知道应用程序工件的Maven属性。

You can use this in an Ansible playbook: 您可以在Ansible剧本中使用它:

- name: Download application_artifact to the apps directory
  maven_artifact:
    group_id: "{{ app_group_id }}"
    version: "{{ application_artifact.version }}"
    artifact_id: "{{ application_artifact.artifact_id }}"
    repository_url: "{{ repository_url }}"
    extension: "{{ application_artifact.type }}"
    dest: "{{ server_dir }}/apps"
    owner: "{{ app_account }}"
    group: "{{ app_group }}"
    mode: 0755

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM