【问题标题】:change temp dir for Neo4j-OGM unit tests?更改 Neo4j-OGM 单元测试的临时目录?
【发布时间】:2015-09-09 21:16:22
【问题描述】:

开箱即用,Neo4j-OGM 库的 junit 测试在 /tmp 下创建临时数据库文件。

我该如何更改?

在 maven-surefire-plugin 配置中设置 java.io.tmpdir 似乎不起作用。

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <java.io.tmpdir>/alt/tmp</java.io.tmpdir>
  </configuration>
</plugin>

【问题讨论】:

    标签: neo4j neo4j-ogm


    【解决方案1】:

    这对我有用

    <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
               <systemProperties>
                   <property>
                       <name>java.io.tmpdir</name>
                       <value>/path/to/temp</value>
                    </property>
               </systemProperties>
         </configuration>
    ...
    </plugin>
    

    更新,因为上面的语法已被弃用:

    <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
                   <systemPropertyVariables>
                      <java.io.tmpdir>/path/to/temp</java.io.tmpdir> 
                   </systemPropertyVariables>
             </configuration>
        ...
        </plugin>
    

    【讨论】:

    • 切换到最新的 Maven 3.3.3 后,它实际上像宣传的那样工作。我一直在使用 Maven 3.1.1。它适用于新的和已弃用的 surefire 的 systemProperties 语法。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-12-04
    • 1970-01-01
    • 1970-01-01
    • 2013-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多