Create src/test/resources in Maven Netbeans 8.x with no manual intervention

一曲冷凌霜 提交于 2020-01-13 08:01:50

问题


The default war and jar archetypes inside Netbeans don't create a src/test/resources and src/test/java directory.

Is there an easy way of creating src/test/resources inside a Maven project without going to the 'Files' tab or creating the directory manually ?

src/test/java gets created when you create a new unit test.

Most of the Netbeans Maven controls are really intuitive, but manually creating the directory is clumsy.


回答1:


Use the new file wizard to create a new folder.

  1. Right click the parent node of the project and choose "New > Folder..." or choose "File > New File > Other > Folder"
  2. Name the folder src/test/java with a parent folder left blank.
  3. Click finish and the Test Packages folder will appear.
  4. Repeat for src/test/resources
  5. It seems a bug prevents the Other Test Sources from being recognised immediately, thus you must reload the pom by right clicking the project > Reload POM.



回答2:


To create new source folder,

  1. Right click on maven project --->Click on Build Path ----->Click on New Source Folder
  2. New source folder window will open, give the name to your folder example - src/test/source
  3. click on Finish


来源:https://stackoverflow.com/questions/28742672/create-src-test-resources-in-maven-netbeans-8-x-with-no-manual-intervention

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