【问题标题】:Java Azure Function on VS Code, how to reference and use external jar librariesVS Code 上的 Java Azure Function,如何引用和使用外部 jar 库
【发布时间】:2019-07-25 22:29:43
【问题描述】:

我在 Java 中创建了我的第一个 Azure 函数,因为我需要使用特定的外部 jar 文件。 我在 VS Code 中工作,我在文档中找到了关于使用外部库的简短参考。 Third-party libraries.

但是我没有让导入工作。如果有一个使用外部库的 VS Code Java Azure Functions 项目的示例或更详细的分步文档,那就太好了。

【问题讨论】:

  • @KetanChawda-MSFT 非常感谢。我正在使用 Azure Functions 扩展和 Java 扩展包来处理 VS Code。我尝试按照您参考中的第一步进行操作,但似乎无法安装需要使用的 jar 文件。我以前没有使用过 java 项目或 maven 的经验。你有更基本的参考吗?你知道是否有办法在 VS Code 中使用工具添加 jar 引用?
  • 在一个maven项目中,所有的依赖都由pom.xml处理。我们可以使用 maven 存储库来下载依赖项,也可以从本地目录添加它。以下可以将 jar 安装到本地 maven 存储库。查看此链接以供参考:maven.apache.org/general.html#importing-jars
  • 还可以查看此 SO 帖子:stackoverflow.com/questions/4955635/…

标签: java jar visual-studio-code azure-functions


【解决方案1】:

在 maven 项目中,所有依赖项都由 pom.xml 处理。我们可以使用 maven 存储库来下载依赖项,也可以从本地目录添加它。以下可以将jar安装到本地maven存储库。

参考资料: http://maven.apache.org/general.html#importing-jars https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

mvn install:install-file
  -Dfile=<path-to-file>
  -DgroupId=<group-id>
  -DartifactId=<artifact-id>
  -Dversion=<version>
  -Dpackaging=<packaging>
  -DgeneratePom=true

Where: <path-to-file>  the path to the file to load
       <group-id>      the group that the file should be registered under
       <artifact-id>   the artifact name for the file
       <version>       the version of the file
       <packaging>     the packaging of the file e.g. jar

【讨论】:

    猜你喜欢
    • 2018-10-30
    • 2019-05-11
    • 1970-01-01
    • 2017-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-27
    相关资源
    最近更新 更多