开发者

Maven dependancy on another non-repository project?

开发者 https://www.devze.com 2023-01-10 11:43 出处:网络
I have 2 completely separate projects where one depends on the other. I\'ve very recently mavenized the main project but can mavenise the dependency if absolutely necessary.

I have 2 completely separate projects where one depends on the other. I've very recently mavenized the main project but can mavenise the dependency if absolutely necessary.

Originally these were Netbeans projects, with the main project having several modules. What I liked is that I could declare the dependency as a dependent project. This allowed me to use the most recent code as it changes a lot (the project is in its infancy). NetBeans would put the dependent project on the classpath when running, and build a jar in the /dist directory when doing a clean and build.

Now that the main project is in maven, I can't do this anymore. The only alternative I've found was to manually copy it into the project repository, but that removes a l开发者_C百科ot of automation and ease of use. Every time I wanted to test a change I would have to rebuild the dependency, move it to the buried project repository folder, rename it appropiatly, switch back to NetBeans, then run. This is vs clicking run and everything being done automatically.

Maybe I'm just lazy, but is there an easy way to do this?


I have 2 completely separate projects where one depends on the other. I've very recently mavenized the main project but can mavenize the dependency if absolutely necessary.

Mavenizing the dependent project would help a lot. Like Eclipse or IntelliJ, NetBeans supports something Eclipse calls Workspace dependency resolution: if a project A depends on a project B and you open both of them in your IDE, A can be configured to depend on B sources instead of B jar (and any change would become immediately visible).


mavenizing the depedency project is the best option.

Alternatively you might get away with using a system scope dependency which points to the dependency project's dist/ folder jar artifact.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号