[英]Glassfish deployed project's dependency libraries
I'm new to Java and dependency management. 我是Java和依赖管理的新手。
I have an EJB jar project with a few maven dependencies. 我有一个带有几个Maven依赖项的EJB jar项目。 When deploying the project to glassfish I get exceptions, that the classes from those dependencies are not found. 将项目部署到glassfish时,出现异常,即找不到那些依赖项中的类。 So I've added a maven plugin to copy over the dependencies from the local repository to {glassfish_dir}/glassfish/domains/domain1/lib
every build. 因此,我添加了一个maven插件,将依赖关系从本地存储库复制到每个版本的{glassfish_dir}/glassfish/domains/domain1/lib
。 I'm also using Netbeans. 我也在使用Netbeans。
Is copying over the the dependencies the proper way to go about this? 复制依赖项是解决此问题的正确方法吗? Is there a better way to make dependencies work with glassfish? 有没有更好的方法来使依赖项与glassfish一起工作?
The best way is to make the Maven pom.xml that builds the .war declare a dependency on your EJB jar project. 最好的方法是使构建.war的Maven pom.xml声明对EJB jar项目的依赖。 That way your EJB jar and any libraries that it has a dependency on, will be included in the .war file that Maven builds. 这样,您的EJB jar和它依赖的所有库将包含在Maven构建的.war文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.