How to import working directory for JUnit from maven to IDEA

ぃ、小莉子 提交于 2019-12-10 14:07:29

问题


I am trying to make new developers of my maven project to have as easy start as possible. I am using and recommending IntelliJ IDEA as an IDE for them. I am pretty satisfied with the results of importing the maven project to IDEA. The only complication that I have now is importing of the working directory from the surefire plugin.

In my pom.xml I have the following:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.7.2</version>
    <configuration>
        <workingDirectory>target/work</workingDirectory>
    </configuration>
</plugin>

This works fine when i run the tests from command line (mvn test). When I create new Idea project, the JUnit tests need aditional setup however. The working directory is ignored and I have to manually set it up to be able to run the tests properly.

Do you have any idea how to make Idea import the working directory for JUnit properly?


回答1:


Please check a discussion in this issue. There an easy workaround for this problem:

set working directory to $MODULE_DIR$ in the defaults for the run configuration that you will use.



来源:https://stackoverflow.com/questions/8397860/how-to-import-working-directory-for-junit-from-maven-to-idea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!