简体   繁体   English

Netbeans:更改包位置而不移动文件

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

相关问题 将类移动到包后,Netbeans Java Web应用程序将不会部署 - Netbeans Java Web Application wont deploy after moving classes to package 将外部库jar包含到NetBeans Project中,而不会出现问题 - Including external libraries jar into NetBeans Project without moving problems 在Netbeans 7中更改JAR文件的目标文件夹 - Change destination folder of JAR files in Netbeans 7 在jar文件中,是否存在与eclipse中的“本地库位置”等效的netbeans? - Is there a netbeans equivalent to “Native library location” in eclipse for jar files? netbeans包中的文件有问题而没有找到.txt文件 - Having problems with files in a netbeans package not finding a .txt file 如何使用NetBeans更改整个程序包中的变量类型? - How can I change the type of variable in the whole package with NetBeans? 将日志文件移动到log4j中的备份位置 - Moving the log files to a backup location in log4j 我的位置正在更新,而我没有使用 altbeacon android studio - My location is updating without me moving using altbeacon android studio 移动到新包后,IntelliJ 将 GIT 存储库的文件标记为未跟踪 - IntelliJ marks files of GIT repository as untracked after moving to new package netbeans构建Maven项目jar文件,而无需依赖jar文件 - netbeans builds Maven projects jar file without dependent jar files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM