简体   繁体   English

添加Maven类路径

[英]Add Maven Classpath

My project requires some external libraries to build in in Eclipse. 我的项目需要一些外部库才能在Eclipse中构建。 They live in /trunk/lib whereas my project is in /trunk/projectA. 它们位于/ trunk / lib中,而我的项目位于/ trunk / projectA中。 To get Eclipse to find the libraries on all machines we set a variable PROJECT_A_HOME. 为了使Eclipse在所有机器上都能找到库,我们设置了变量PROJECT_A_HOME。

Now I'm trying to get some builds going with maven and I can not figure out how to add that path (be it environmental variable or relative to $(basedir)) to the build. 现在我正在尝试使用Maven进行一些构建,但我不知道如何将路径(环境变量或相对于$(basedir)的路径)添加到构建中。 I really do not want to set up a repository for these dependencies, as I keep them in source control and want builds to continue to work in Eclipse. 我真的不想为这些依赖项建立存储库,因为我将它们保留在源代码控制中,并且希望构建继续在Eclipse中工作。

I've seen talk about but that hasn't worked for me. 我看到过谈论,但这对我没有用。

Ideas ? 想法?

You should put your static configuration files in resources/ dir. 您应该将静态配置文件放在resources / dir中。 If you have your own or proprietary jars you should set a your own repository so you can download them from the repository or better yet just install them manually , here is how 如果您有自己的或专有的jar,则应设置自己的存储库,以便可以从存储库下载它们,或者更好的方法是手动安装它们,这就是

http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

Setting up a file-based repository as suggested in this previous question would allow to keep the libs in your version control system and work seamlessly at the Eclipse level (the libs would be treated like any other dependency). 按照上一个问题中的建议设置基于文件的存储库,可以将这些库保留在您的版本控制系统中,并可以在Eclipse级别无缝地工作(这些库将被视为任何其他依赖项)。 The only problem I can think of could be at the continuous integration level: a build of projectA would require a checkout of trunk/lib . 我能想到的唯一问题可能是在持续集成级别上:构建projectA将需要检出trunk/lib Many CI tools would allow to implement this though. 不过,许多CI工具都可以实现这一点。 And if not, moving the libs under projectA (or another mavenized project project if you need to share them between modules) would do the trick. 如果不是这样,将库projectA (或需要在模块之间共享它们的另一个项目化项目)下可以解决问题。

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

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