简体   繁体   English

NetBeans和Maven:在运行项目时建立依赖关系

[英]NetBeans and Maven: Build dependencies upon running a project

I was wondering whether or not it is possible to tell NetBeans (I am running NetBeans 8.0.2) to build a project (let's call that "Project A") that is a dependency of another project (let's call that "Project B") whenever the second project is run. 我想知道是否可以告诉NetBeans(我正在运行NetBeans 8.0.2)构建一个项目(让我们将其称为“ Project A”),该项目依赖于另一个项目(让我们将其称为“ Project B”)。每当第二个项目运行时。

I'll try to explain: 我将尝试解释:

Project A is a library. 项目A是一个库。 Project B is a simple test application for said library. 项目B是该库的简单测试应用程序。 Ergo, once I change anything in the library (A), I need to build it before I can run/debug the test application (B). 如此,一旦我更改了库(A)中的任何内容,就需要先构建它,然后才能运行/调试测试应用程序(B)。 Oh, both projects are usign Maven (but I'd prefer a solution that does not involve Maven). 哦,这两个项目都是Mign的老手(但我更喜欢涉及Maven的解决方案)。

From time to time it simply happens: I forget that I have to build the library and wonder why my changes won't work (well, of course they won't, the library's changes have not yet been built). 它有时不时发生:我忘记了我必须建立库并想知道为什么我的更改不起作用(嗯,当然,它们不会起作用,库的更改尚未构建)。

So my question is: how can I tell NetBeans (I'd prefer not to use Maven for this) to always build the library when I run or debug the test application? 所以我的问题是:当我运行或调试测试应用程序时,如何告诉NetBeans(我不希望使用Maven)始终构建该库?

Hope you guys can find me an answer to this question, it's driving me crazy! 希望你们能找到我这个问题的答案,这让我发疯了!

Thanks in advance, feel free to ask if I did not make everything clear. 在此先感谢您,如果我没有弄清楚一切,请随时问。

How to add one Maven project as a dependency of another in Netbeans: 如何在Netbeans中将一个Maven项目添加为另一个项目的依赖项:

  1. Open Both Projects 打开两个项目
  2. Right-click Dependencies under Project B 右键单击项目B下的依赖项
  3. Choose "Add Dependency ..." from pop-up menu. 从弹出菜单中选择“添加依赖项...”。
  4. Select the Open Projects Tab in the Dialog box. 在对话框中选择“打开项目”选项卡。
  5. Select Project A from the list. 从列表中选择项目A。

I made a screencast video showing Netbeans working correctly with a dependant module: https://youtu.be/SOp070b3m24 我制作了一个截屏视频,显示Netbeans在依赖模块上正常工作: https : //youtu.be/SOp070b3m24

In the video, mavenproject9 depends on mavenproject10. 在视频中,mavenproject9取决于mavenproject10。 I edit a value in a class in mavenproject10 and then immediately run mavenproject9 and get the updated value. 我在mavenproject10中的类中编辑一个值,然后立即运行mavenproject9并获取更新的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM