[英]Netbeans: change package location without moving files
I have a netbeans project with directories like: 我有一个目录类似于netbeans的项目:
Top
- pom.xml
- src
|
- main
|
- java
|
- com
|
- foo
|
- bar
A.java
B.java
The package designation for A.java then is: 那么,A.java的软件包名称为:
package main.com.foo.bar
Where netbeans is using the toplevel directory as the source, and reading the pom.xml file to bring in maven dependencies. netbeans使用顶级目录作为源,并读取pom.xml文件以引入maven依赖关系。
My colleagues are developing in Eclipse, and their package headers are 我的同事正在Eclipse中开发,他们的程序包头是
package com.foo.bar
Is it possible to somehow specify to netbeans that the com folder should be recognized as the top-level directory for the source files, but retain the location of pom.xml? 是否有可能以某种方式向netbeans指定com文件夹应被视为源文件的顶级目录,但保留pom.xml的位置? They were able to implement such packaging in Eclipse by specifying the source directory as com, somehow. 通过某种方式将源目录指定为com,他们能够在Eclipse中实现这种打包。
Maven is about, defaults and some established conventions. Maven关于默认值和一些已建立的约定。 The structure is . 结构是。
src / main / java / com / foo / bar src / main / java / com / foo / bar
You are missing the java sub-folder. 您缺少Java子文件夹。 If you add it then automatically all the IDE's that properly support and use Maven will import your code properly. 如果添加了它,那么将自动正确支持和使用Maven的所有IDE都将正确导入代码。
Please have a look if you have some spare time to the standard maven layout 请看一下您是否有一些空闲时间来使用标准的Maven布局
Hope that helps 希望能有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.