可以通过eclipse(和m2e)的方式来处理WEB-INF \lib吗? [英] Can maven treat WEB-INF\lib the way eclipse (and m2e) does?
问题描述
WEB-INF \lib
文件夹(删除所有依赖项)工作区)。当我运行包
maven目标时,我会收到来自此jar的缺少类的消息: [错误]编译错误:
[INFO] --------------------------------- ----------------------------
#.....注意这是一个自定义JAR
[错误] /C:/path/DataServlet.java:[3,30] package xxx.java.helpers不存在
现在已经被问到之前,最严格的解决方案似乎是创建一个本地的回购:我可以添加jar到maven 2构建类路径而不安装它们吗?(注意:我在maven 3 )。
我想避免这一点 - 所以有什么方法,maven将只是将这个jar填充到$ code> WEB-INF \lib 在 war
?
使用一些maven插件的解决方案 cp
欢迎战争中 WEB-INF \lib
的内容 - 虽然我只是有这样的感觉应该有一个解决方案,考虑到这个文件夹的特殊性质。
观察:
-
Alt + F5删除此行:
classpathentry kind =conpath =org.eclipse.jst.j2ee.internal.web.container/>
它对应于Java Build Path中的Web App库。所以不仅maven拒绝考虑到
WEB-INF \lib
- 它也会完全打破eclipse的构建路径。
相关:
- Maven:如何将jar包含在Eclipse中,它们在存储库中不可用?
- 使用maven eclipse插件: - 与m2e不兼容
- m2e eclipse插件如何与eclipse交互? - 显然m2e检查pom然后cal ls eclipse构建器(因此读取
.classpath
) - Eclipse启用maven的Web应用程序引用工作空间项目,但是在运行Tomcat服务器
- 部署一个依赖于在Eclipse中运行的Tomcat或Jboss的Maven项目
您是否将WEB-INF \lib中的jar添加为依赖关系:
<依赖性>
< groupId> someGroupId< / groupId>
< artifactId> someArtifactId< / artifactId>
< version> 1.0.0< / version>
< scope> system< / scope>
< systemPath> $ {basedir} / src / main / webapp / WEB-INF / lib / homebrew jar< / systemPath>
< / dependency>
I have a servlet/jsp web project which runs fine on eclipse and is exported as war fine (once I clean it that is). I mavenized the project deleting all of the dependencies from the WEB-INF\lib
folder except a homebrew jar (the output of another project in the workspace). When I run the package
maven goal I get messages for missing classes from this jar:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
#..... NOTICE THIS COMES FROM A CUSTOM JAR
[ERROR] /C:/path/DataServlet.java:[3,30] package xxx.java.helpers does not exist
Now this has been asked before and the most rigorous solution appears to be to create a local repo: Can I add jars to maven 2 build classpath without installing them? (NB: I am at maven 3).
I would like to avoid this - so is there any way maven will just stuff this jar to WEB-INF\lib
in the war
?
Solutions that use some maven plugin to cp
the contents of the WEB-INF\lib
in the war are welcome - although I just have this feeling that there should be a solution that takes into account the "special" nature of this folder.
Observations:
Alt+F5 removes this line:
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
which corresponds to the "Web App libraries" in the Java Build Path. So not only maven refuses to take into account the
WEB-INF\lib
- it also breaks the build path of eclipse completely.
Related:
- Maven: How to include jars in Eclipse, which are not available in repository?
- Uses the maven eclipse plugin : update my classpath with an Eclipse User Library via the maven eclipse plugin - not compatible with m2e
- How does the m2e eclipse plugin interact with eclipse? - apparently m2e checks the pom then calls the eclipse builders (hence the
.classpath
is read) - Eclipse maven-enabled web app references workspace projects, but those are not deployed when running Tomcat server
- Deploying a Maven project with dependencies to Tomcat or Jboss running within Eclipse
Did you add this jar from WEB-INF\lib as a dependency like this:
<dependency>
<groupId>someGroupId</groupId>
<artifactId>someArtifactId</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/homebrew jar</systemPath>
</dependency>
这篇关于可以通过eclipse(和m2e)的方式来处理WEB-INF \lib吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!