[英]Test library within the project
I'm currently building a java utility library which can be use as maven dependency. 我目前正在建立一个Java实用程序库,可用作maven依赖项。
At the moment to simulate how the user use it, I need to create another project in intellij and put the dependency in the pom.xml 目前,为了模拟用户的使用方式,我需要在intellij中创建另一个项目,并将依赖项放入pom.xml中。
Does anyone know if there's any other way to test dependency without creating another project outside? 有谁知道是否有其他方法可以在不创建其他项目的情况下测试依赖关系? I would like to keep all the tests in the same project.
我想将所有测试保留在同一项目中。
Thank you. 谢谢。
With maven and IntelliJ Idea you can create a project containing several modules. 使用maven和IntelliJ Idea,您可以创建一个包含多个模块的项目。 To achieve this, create a simple maven project and add following to its pom file:
为此,请创建一个简单的maven项目并将以下内容添加到其pom文件中:
<packaging>pom</packaging>
Then right-click on the root of your project tree and select New > Module > Maven. 然后右键单击项目树的根,然后选择“新建”>“模块”>“ Maven”。 This will create a nested module.
这将创建一个嵌套模块。 For your case you can create the main and the test modules and use them as dependencies for each other.
对于您的情况,您可以创建主要模块和测试模块,并将它们用作彼此的依赖项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.