maven笔记:maven-overlay-实战笔记
背景说明:
我现在要同时推进开发两个应用,分别是代码工程myportal和代码工程info-base。其中myportal工程的设计目标是做通用化组件,而info-base工程是具体的业务应用,下来我想让info-base工程开发只关注具体的业务应用,而门户、安全、日志等交给myportal来开发,那么如何实现并行开发而又无缝整合呢?
进行下面两步配置即可,完整配置参考附件。
1、依赖配置:
<dependency>
<groupId>org.waddy</groupId>
<artifactId>myportal</artifactId>
<version>1.2.0-SNAPSHOT</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
注意需要依赖类型为war.
2、覆盖配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<archiveClasses>${war.archiveClasses}</archiveClasses>
<overlays>
<overlay>
<groupId>org.waddy</groupId>
<artifactId>myportal</artifactId>
<excludes>
<exclude>**/product.properties</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
其中<excludes>是排除选项标签,将你不想引入的内容放在这里即可。
嗯,是每次都要打war包,但我平时开发过程中都是分开调试的,即两个代码工程各调各的,确定基本没有问题了 再集成到一起发布就好了。
那样的话开发起来岂不是很慢每次运行都需要打war包发布?修改jsp或者java每次都需要重启? 不知道你的开发是怎么个情况。
我用的eclipse,实践中可以正常覆盖,我这边没有做热部署
请问你现在是按照这个方式开发的吗?在开发过程中使用的是什么工具,是如何热部署的呢? 我现在使用myeclipse 开发,进行部署的时候以来的war包里面的内容无法部署,不知道有什么好的办法。
没能从你提供的日志中看出报错的原因来。 但如果是因为index2.jsp没有覆盖成功,应该检查你的pom.xml设置(注意文中提及的两点),祝好
你好,最近看了maven-overlay 在平时开发的时候使用 myeclipse 覆盖的部署不上。 例如 在 crm-webapp里创建了一个index2.jsp 在simple-webapp overlay了crm-webapp 部署目录没有index2.jsp 使用jetty插件部署 结果报错 2014-01-20 21:58:27.979:WARN:oejw.WebAppContext:Failed startup of context o.m.j.p.JettyWebAppContext{/simple-webapp,},file:/D:/springWorkspaces/simple-parent/simple-webapp/src/main/webapp/ java.lang.IllegalStateException: Duplicate fragment name: spring_web for jar:file:/C:/Users/wangjd/.m2/repository/org/sp ringframework/spring-web/3.2.2.RELEASE/spring-web-3.2.2.RELEASE.jar!/META-INF/web-fragment.xml and jar:file:/D:/springWo rkspaces/simple-parent/simple-webapp/target/tmp/crm-webapp-1_0-SNAPSHOT_war/WEB-INF/lib/spring-web-3.2.2.RELEASE.jar!/ME TA-INF/web-fragment.xml at org.eclipse.jetty.webapp.MetaData.addFragment(MetaData.java:253) 能给解决一下问题吗?