Maven 如何从覆盖WAR中排除lib文件
我使用Alfresco和maven overlay函数将amp模块包含到单个WAR文件中 这是我的POM文件Maven 如何从覆盖WAR中排除lib文件,maven,overlay,alfresco,Maven,Overlay,Alfresco,我使用Alfresco和maven overlay函数将amp模块包含到单个WAR文件中 这是我的POM文件 <?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with
<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to
You under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>repo</artifactId>
<name>Alfresco Repository WAR Aggregator</name>
<packaging>war</packaging>
<description>Alfresco Repository aggregator, installs your repository AMPs in the Alfresco WAR for aggregation and easy deployment purposes</description>
<parent>
<groupId>au.com.abc.alfresco</groupId>
<artifactId>enterprise-all-in-one</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<properties>
<!-- During development we set log root level to Debug,
this will be applicable to the log configuration in
repo/src/main/resources/alfresco/extension/dev-log4j.properties,
such as DemoComponent logging. -->
<app.log.root.level>DEBUG</app.log.root.level>
</properties>
<dependencies>
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>${alfresco.repo.artifactId}</artifactId>
<version>${alfresco.version}</version>
<type>war</type>
</dependency>
<!-- Demonstrating the dependency / installation of the repo AMP developed in the 'repo-amp' module -->
<dependency>
<groupId>au.com.abc.alfresco</groupId>
<artifactId>abc-repo-common</artifactId>
<version>${abc.repo.common.parent.version}</version>
<type>amp</type>
</dependency>
<dependency>
<groupId>au.com.abc.alfresco</groupId>
<artifactId>abc-repo-common-classes</artifactId>
<version>${abc.repo.common.parent.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>au.com.abc.alfresco</groupId>
<artifactId>abc-repo-bpmf</artifactId>
<version>${project.version}</version>
<type>amp</type>
</dependency>
<dependency>
<groupId>au.com.abc.alfresco</groupId>
<artifactId>abc-repo-batp</artifactId>
<version>${project.version}</version>
<type>amp</type>
</dependency>
<dependency>
<groupId>au.com.abc.alfresco</groupId>
<artifactId>abc-repo-ctp</artifactId>
<version>${project.version}</version>
<type>amp</type>
</dependency>
<dependency>
<groupId>au.com.abc.alfresco</groupId>
<artifactId>abc-repo-life</artifactId>
<version>${project.version}</version>
<type>amp</type>
</dependency>
<dependency>
<groupId>au.com.abc.alfresco</groupId>
<artifactId>abc-repo-mpc</artifactId>
<version>${project.version}</version>
<type>amp</type>
</dependency>
<dependency>
<groupId>org.alfresco.aos-module</groupId>
<artifactId>alfresco-aos-module</artifactId>
<version>1.1-65</version>
<type>amp</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<!-- Here is can control the order of overlay of your (WAR, AMP, etc.) dependencies
| NOTE: At least one WAR dependency must be uncompressed first
| NOTE: In order to have a dependency effectively added to the WAR you need to
| explicitly mention it in the overlay section.
| NOTE: First-win resource strategy is used by the WAR plugin
-->
<overlays>
<!-- Current project customizations. This is normally empty, since customizations come from the AMPs -->
<overlay />
<!-- The Alfresco WAR -->
<overlay>
<groupId>${alfresco.groupId}</groupId>
<artifactId>${alfresco.repo.artifactId}</artifactId>
<type>war</type>
<!-- To allow inclusion of META-INF -->
<excludes />
</overlay>
<overlay>
<groupId>${project.groupId}</groupId>
<artifactId>abc-repo-bpmf</artifactId>
<type>amp</type>
</overlay>
<overlay>
<groupId>${project.groupId}</groupId>
<artifactId>abc-repo-common</artifactId>
<type>amp</type>
</overlay>
<overlay>
<groupId>${project.groupId}</groupId>
<artifactId>abc-repo-batp</artifactId>
<type>amp</type>
</overlay>
<overlay>
<groupId>${project.groupId}</groupId>
<artifactId>abc-repo-ctp</artifactId>
<type>amp</type>
</overlay>
<overlay>
<groupId>${project.groupId}</groupId>
<artifactId>abc-repo-life</artifactId>
<type>amp</type>
</overlay>
<overlay>
<groupId>${project.groupId}</groupId>
<artifactId>abc-repo-mpc</artifactId>
<type>amp</type>
</overlay>
<overlay>
<groupId>org.alfresco.aos-module</groupId>
<artifactId>alfresco-aos-module</artifactId>
<type>amp</type>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<!-- Overrides the run profile to disable securecomms and add rapid development configuration -->
<profile>
<id>run</id>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>prepare-exploded-war</id>
<goals>
<goal>exploded</goal>
</goals>
<phase>prepare-package</phase>
</execution>
<execution>
<id>default-war</id>
<!--<configuration>
<webXml>${project.build.directory}/${project.build.finalName}-nossl/WEB-INF/web.xml</webXml>
</configuration> -->
</execution>
</executions>
</plugin>
<!-- Replaces web.xml where applicable, commenting out the security-constraints -->
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<executions>
<execution>
<id>disable-securecomms</id>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<ignoreErrors>true</ignoreErrors>
<file>${project.build.directory}/${project.build.finalName}/WEB-INF/web.xml</file>
<outputDir>${project.build.directory}/${project.build.finalName}-nossl/WEB-INF/</outputDir>
<preserveDir>false</preserveDir>
<replacements>
<replacement>
<token>
<![CDATA[<!-- Toggle securecomms placeholder start -->]]>
</token>
<value>
<![CDATA[<!--]]>
</value>
</replacement>
<replacement>
<token>
<![CDATA[<!-- Toggle securecomms placeholder end -->]]>
</token>
<value>
<![CDATA[-->]]>
</value>
</replacement>
</replacements>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.alfresco.maven</groupId>
<artifactId>alfresco-rad</artifactId>
<version>${maven.alfresco.version}</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
4.0.0
回购
露天仓库战争聚合器
战争
Alfresco Repository aggregator,在Alfresco WAR中安装存储库AMP,以便于聚合和部署
户外
企业一元化
1.1-快照
调试
${alfresco.groupId}
${alfresco.repo.artifactId}
${alfresco.version}
战争
户外
abc回购普通股
${abc.repo.common.parent.version}
放大器
户外
abc回购普通类
${abc.repo.common.parent.version}
罐子
户外
abc回购bpmf
${project.version}
放大器
户外
abc回购batp
${project.version}
放大器
户外
abc回购ctp
${project.version}
放大器
户外
abc回购人寿保险
${project.version}
放大器
户外
abc回购mpc
${project.version}
放大器
org.alfresco.aos-module
露天aos模块
1.1-65
放大器
maven战争插件
${alfresco.groupId}
${alfresco.repo.artifactId}
战争
${project.groupId}
abc回购bpmf
放大器
${project.groupId}
abc回购普通股
放大器
${project.groupId}
abc回购batp
放大器
${project.groupId}
abc回购ctp
放大器
${project.groupId}
abc回购人寿保险
放大器
${project.groupId}
abc回购mpc
放大器
org.alfresco.aos-module
露天aos模块
放大器
跑
maven战争插件
准备爆发战争
爆炸了的
准备包装
默认战争
com.google.code.maven-replacer-plugin
替代者
禁用安全通信
准备包装
代替
真的
${project.build.directory}/${project.build.finalName}/WEB-INF/WEB.xml
${project.build.directory}/${project.build.finalName}-nossl/WEB-INF/
假的
]]>
]]>
]]>
org.alfresco.maven
露天无线电
${maven.alfresco.version}
我试过使用
,
,但对我不起作用
有谁能给我一些代码示例或提供一些指针吗?这里有一个将JAR排除在overlay WAR之外的示例:
<plugins>
<!-- put aside some unwanted jars from war...-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<overlays>
<overlay>
<groupId>com.company.app</groupId>
<artifactId>web_app</artifactId>
<excludes>
<exclude>WEB-INF/lib/json-lib-2.2.2-jdk13.jar</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
org.apache.maven.plugins
maven战争插件
2.1.1
com.company.app
网络应用