<legend id='fAEco'><style id='fAEco'><dir id='fAEco'><q id='fAEco'></q></dir></style></legend>
    <bdo id='fAEco'></bdo><ul id='fAEco'></ul>
  • <i id='fAEco'><tr id='fAEco'><dt id='fAEco'><q id='fAEco'><span id='fAEco'><b id='fAEco'><form id='fAEco'><ins id='fAEco'></ins><ul id='fAEco'></ul><sub id='fAEco'></sub></form><legend id='fAEco'></legend><bdo id='fAEco'><pre id='fAEco'><center id='fAEco'></center></pre></bdo></b><th id='fAEco'></th></span></q></dt></tr></i><div id='fAEco'><tfoot id='fAEco'></tfoot><dl id='fAEco'><fieldset id='fAEco'></fieldset></dl></div>

  • <tfoot id='fAEco'></tfoot>

    <small id='fAEco'></small><noframes id='fAEco'>

        作为 Gradle Java 项目的一部分在本地运行 Dynamodb

        Run Dynamodb local as part of a Gradle Java project(作为 Gradle Java 项目的一部分在本地运行 Dynamodb)

            <tfoot id='FoaxD'></tfoot>

              • <small id='FoaxD'></small><noframes id='FoaxD'>

                  <tbody id='FoaxD'></tbody>

              • <i id='FoaxD'><tr id='FoaxD'><dt id='FoaxD'><q id='FoaxD'><span id='FoaxD'><b id='FoaxD'><form id='FoaxD'><ins id='FoaxD'></ins><ul id='FoaxD'></ul><sub id='FoaxD'></sub></form><legend id='FoaxD'></legend><bdo id='FoaxD'><pre id='FoaxD'><center id='FoaxD'></center></pre></bdo></b><th id='FoaxD'></th></span></q></dt></tr></i><div id='FoaxD'><tfoot id='FoaxD'></tfoot><dl id='FoaxD'><fieldset id='FoaxD'></fieldset></dl></div>
              • <legend id='FoaxD'><style id='FoaxD'><dir id='FoaxD'><q id='FoaxD'></q></dir></style></legend>
                  <bdo id='FoaxD'></bdo><ul id='FoaxD'></ul>
                  本文介绍了作为 Gradle Java 项目的一部分在本地运行 Dynamodb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试在本地运行 DynamoDB 以进行测试.我按照亚马逊提供的步骤设置它并自行运行 jar 可以正常工作(链接到亚马逊的教程 这里).但是,本教程不会在您自己的项目中运行 jar.我不希望所有其他开发人员每次测试代码时都必须获取一个 jar 并在本地运行它.

                  这就是我的问题所在.作为我的测试的一部分,我很难在网上找到任何关于如何配置 Gradle 项目以运行 DynamoDB 本地服务器的示例.我找到了以下 maven 示例 https://github.com/awslabs/aws-dynamodb-examples/blob/master/src/test/java/com/amazonaws/services/dynamodbv2/DynamoDBLocalFixture.java#L32 并且正在尝试将其转换为 Gradle,但他们正在使用的所有 com.amazonaws.services.dynamodbv2.local 导入语句都出现错误.错误是找不到资源.

                  我进入他们项目的 pom 并将以下内容放入我的 build.gradle 文件中以模拟它.

                  <块引用>

                  //dynamodb 本地依赖testCompile('com.amazonaws:aws-java-sdk-dynamodb:1.10.42')testCompile('com.amazonaws:aws-java-sdk-cloudwatch:1.10.42')testCompile('com.amazonaws:aws-java-sdk:1.3.0')testCompile('com.amazonaws:amazon-kinesis-client:1.6.1')testCompile('com.amazonaws:amazon-kinesis-connectors:1.1.1')testCompile('com.amazonaws:dynamodb-streams-kinesis-adapter:1.0.2')testCompile('com.amazonaws:DynamoDBLocal:1.10.5.1')

                  导入语句仍然失败.这是一个失败的例子.

                  import com.amazonaws.services.dynamodbv2.local.embedded.DynamoDBEmbedded;

                  TL;DR

                  有没有人设法让 DynamoDB 本地 JAR 作为 Gradle 项目的一部分执行,或者有一个好的教程链接(不一定是我链接到的教程).

                  解决方案

                  我们有 DynamoDB 本地使用 gradle.以下是您需要添加到 gradle.build 文件中的内容:

                  适用于 gradle 4.x 及以下版本

                  1) 添加到存储库部分:

                   行家 {网址http://dynamodb-local.s3-website-us-west-2.amazonaws.com/release"}

                  2) 添加到依赖项部分(假设您将其用于测试):

                   testCompile 组:'com.amazonaws',名称:'DynamoDBLocal',版本:1.11.0

                  3) 接下来的两个步骤是棘手的部分.首先将本机文件复制到一个目录:

                  任务 copyNativeDeps(type: Copy) {来自(configurations.testCompile){包括*.dylib"包括*.so"包括*.dll"}进入构建/库"}

                  4) 然后确保在 java 库路径中包含这个目录(在我们的例子中是 build/libs):

                  test.dependsOn copyNativeDeps测试.doFirst {系统属性java.library.path",构建/库"}

                  现在您应该能够运行 ./gradlew test 并让您的测试进入您的本地 DynamoDB.

                  I am trying to run DynamoDB local for testing purposes. I followed the steps amazon provides for setting it up and running the jar by itself works fine (link to amazon's tutorial Here). However, the tutorial doesn't go over running the jar within your own project. I don't want all the other developers to have to grab a jar and run it locally every time they test their code.

                  That is where my question comes in. I've had a real hard time finding any examples online of how to configure a Gradle project to run the DynamoDB local server as part of my tests. I found the following maven example https://github.com/awslabs/aws-dynamodb-examples/blob/master/src/test/java/com/amazonaws/services/dynamodbv2/DynamoDBLocalFixture.java#L32 and am trying to convert it to a Gradle, but am getting errors for all of com.amazonaws.services.dynamodbv2.local import statements they are using. The errors are that the resource cannot be found.

                  I went into their project's pom and put the following into my build.gradle file to emulate it.

                  //dynamodb local dependencies
                  testCompile('com.amazonaws:aws-java-sdk-dynamodb:1.10.42')
                  testCompile('com.amazonaws:aws-java-sdk-cloudwatch:1.10.42')
                  testCompile('com.amazonaws:aws-java-sdk:1.3.0')
                  testCompile('com.amazonaws:amazon-kinesis-client:1.6.1')
                  testCompile('com.amazonaws:amazon-kinesis-connectors:1.1.1')
                  testCompile('com.amazonaws:dynamodb-streams-kinesis-adapter:1.0.2')
                  testCompile('com.amazonaws:DynamoDBLocal:1.10.5.1')
                  

                  The import statements still fail. Here is an example of one that fails.

                  import com.amazonaws.services.dynamodbv2.local.embedded.DynamoDBEmbedded;
                  

                  TL;DR

                  Has anyone managed to get the DynamoDB local JAR to execute as part of a Gradle project or have a link to a good tutorial (it doesn't have to be the tutorial I linked to).

                  解决方案

                  We have DynamoDB local working with gradle. Here's what you need to add to your gradle.build file:

                  For gradle 4.x and below versions

                  1) Add to the repositories section:

                      maven {
                          url 'http://dynamodb-local.s3-website-us-west-2.amazonaws.com/release'
                      }
                  

                  2) Add to the dependencies section (assuming you're using this for your tests):

                      testCompile group: 'com.amazonaws', name: 'DynamoDBLocal', version: 1.11.0
                  

                  3) These next two steps are the tricky part. First copy the native files to a directory:

                  task copyNativeDeps(type: Copy) {
                      from (configurations.testCompile) {
                          include "*.dylib"
                          include "*.so"
                          include "*.dll"
                      }
                      into 'build/libs'
                  }
                  

                  4) Then make sure you include this directory (build/libs in our case) in the java library path like so:

                  test.dependsOn copyNativeDeps
                  test.doFirst {
                      systemProperty "java.library.path", 'build/libs'
                  }
                  

                  Now you should be able to run ./gradlew test and have your tests hit your local DynamoDB.

                  这篇关于作为 Gradle Java 项目的一部分在本地运行 Dynamodb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Lucene Porter Stemmer not public(Lucene Porter Stemmer 未公开)
                  How to index pdf, ppt, xl files in lucene (java based or python or php any of these is fine)?(如何在 lucene 中索引 pdf、ppt、xl 文件(基于 java 或 python 或 php 中的任何一个都可以)?)
                  KeywordAnalyzer and LowerCaseFilter/LowerCaseTokenizer(KeywordAnalyzer 和 LowerCaseFilter/LowerCaseTokenizer)
                  How to search between dates (Hibernate Search)?(如何在日期之间搜索(休眠搜索)?)
                  How to get positions from a document term vector in Lucene?(如何从 Lucene 中的文档术语向量中获取位置?)
                  Java Lucene 4.5 how to search by case insensitive(Java Lucene 4.5如何按不区分大小写进行搜索)

                      <bdo id='awDAd'></bdo><ul id='awDAd'></ul>

                      1. <tfoot id='awDAd'></tfoot>

                        <i id='awDAd'><tr id='awDAd'><dt id='awDAd'><q id='awDAd'><span id='awDAd'><b id='awDAd'><form id='awDAd'><ins id='awDAd'></ins><ul id='awDAd'></ul><sub id='awDAd'></sub></form><legend id='awDAd'></legend><bdo id='awDAd'><pre id='awDAd'><center id='awDAd'></center></pre></bdo></b><th id='awDAd'></th></span></q></dt></tr></i><div id='awDAd'><tfoot id='awDAd'></tfoot><dl id='awDAd'><fieldset id='awDAd'></fieldset></dl></div>
                          <tbody id='awDAd'></tbody>

                        <small id='awDAd'></small><noframes id='awDAd'>

                            <legend id='awDAd'><style id='awDAd'><dir id='awDAd'><q id='awDAd'></q></dir></style></legend>