简体   繁体   English

项目内的测试库

[英]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.

相关问题 在当前项目中测试项目 - Test project within a current project 如何将java库连接到项目以测试库 - how to connect java library to project to test the library 项目库上的Android Instrumented单元测试 - Android Instrumented unit test on project library 在库项目中使用库项目的正确值/strings.xml - Use the correct values/strings.xml of a library project from within the library project 尝试在Spring项目中使用Maven和Junit删除测试数据 - Trying to remove test data with maven and junit within Spring project Maven项目不会在Selenium项目的test-output文件夹中生成testng结果 - Maven project does not generate testng results within test-output folder from selenium project 我可以使用哪些指标来验证和测试Lemur项目中RankLib库中的RankNet? - What metrics can I use to validate and test RankNet in the RankLib library in the Lemur Project? 添加Android库:只能导入类型。 com.project.test.networktasklibrary解析为一个包 - Adding Android Library: Only a type can be imported. com.project.test.networktasklibrary resolves to a package 如何从我自己的Maven库中修改一个项目的Maven测试执行阶段的命令行arguments? - How to modify the command line arguments of the Maven test execution phase of a project from my own Maven library? maven项目中的库项目中的ClassNotFoundException - ClassNotFoundException in a library Project in a maven Project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM