Bug 8677: Do Karaf patch-ing earlier and only once
[odlparent.git] / karaf / opendaylight-karaf-resources / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
4
5  This program and the accompanying materials are made available under the
6  terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  and is available at http://www.eclipse.org/legal/epl-v10.html
8 -->
9 <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/xsd/maven-4.0.0.xsd">
10   <modelVersion>4.0.0</modelVersion>
11   <parent>
12     <groupId>org.opendaylight.odlparent</groupId>
13     <artifactId>odlparent</artifactId>
14     <version>2.1.0-SNAPSHOT</version>
15     <relativePath>../../odlparent</relativePath>
16   </parent>
17   <artifactId>opendaylight-karaf-resources</artifactId>
18   <description>Resources for opendaylight-karaf</description>
19   <packaging>jar</packaging>
20   <name>ODL :: odlparent :: ${project.artifactId}</name>
21   <dependencies>
22     <dependency>
23       <groupId>org.apache.karaf.features</groupId>
24       <artifactId>framework</artifactId>
25       <version>${karaf.version}</version>
26       <type>kar</type>
27     </dependency>
28     <dependency>
29       <groupId>org.apache.karaf.features</groupId>
30       <artifactId>standard</artifactId>
31       <version>${karaf.version}</version>
32       <classifier>features</classifier>
33       <type>xml</type>
34       <scope>runtime</scope>
35     </dependency>
36   </dependencies>
37   <build>
38     <resources>
39       <resource>
40         <directory>src/main/resources</directory>
41         <filtering>false</filtering>
42       </resource>
43     </resources>
44     <plugins>
45       <plugin>
46         <artifactId>maven-antrun-plugin</artifactId>
47         <executions>
48           <execution>
49             <id>patch-karaf-scripts</id>
50             <phase>prepare-package</phase>
51             <goals>
52               <goal>run</goal>
53             </goals>
54             <configuration>
55               <target>
56                 <!-- Patches only work with LF line endings from ant -->
57                 <fixcrlf srcdir="${project.build.directory}/assembly/bin"
58                          includes="*.bat" eol="lf"/>
59                 <patch patchfile="${project.basedir}/src/main/patches/karaf-instance.patch"
60                        originalfile="${project.build.directory}/assembly/bin/instance"
61                        failonerror="true"/>
62                 <copy file="${project.build.directory}/assembly/bin/instance"
63                       tofile="${project.build.directory}/classes/bin/instance"/>
64                 <patch patchfile="${project.basedir}/src/main/patches/karaf-instance.bat.patch"
65                        originalfile="${project.build.directory}/assembly/bin/instance.bat"
66                        failonerror="true" ignorewhitespace="true"/>
67                 <copy file="${project.build.directory}/assembly/bin/instance.bat"
68                       tofile="${project.build.directory}/classes/bin/instance.bat"/>
69                 <patch patchfile="${project.basedir}/src/main/patches/karaf-karaf-${karaf.version}.patch"
70                        originalfile="${project.build.directory}/assembly/bin/karaf"
71                        failonerror="true"/>
72                 <copy file="${project.build.directory}/assembly/bin/karaf"
73                       tofile="${project.build.directory}/classes/bin/karaf"/>
74                 <patch patchfile="${project.basedir}/src/main/patches/karaf-karaf.bat.patch"
75                        originalfile="${project.build.directory}/assembly/bin/karaf.bat"
76                        failonerror="true"/>
77                 <copy file="${project.build.directory}/assembly/bin/karaf.bat"
78                       tofile="${project.build.directory}/classes/bin/karaf.bat"/>
79                 <patch patchfile="${project.basedir}/src/main/patches/karaf-setenv-${karaf.version}.patch"
80                        originalfile="${project.build.directory}/assembly/bin/setenv"
81                        failonerror="true"/>
82                 <copy file="${project.build.directory}/assembly/bin/setenv"
83                       tofile="${project.build.directory}/classes/bin/setenv"/>
84                 <patch patchfile="${project.basedir}/src/main/patches/karaf-setenv.bat.patch"
85                        originalfile="${project.build.directory}/assembly/bin/setenv.bat"
86                        failonerror="true"/>
87                 <copy file="${project.build.directory}/assembly/bin/setenv.bat"
88                       tofile="${project.build.directory}/classes/bin/setenv.bat"/>
89                 <patch patchfile="${project.basedir}/src/main/patches/karaf-quiesce-${karaf.version}.patch"
90                        originalfile="${project.build.directory}/assembly/system/org/apache/karaf/features/standard/${karaf.version}/standard-${karaf.version}-features.xml"
91                        failonerror="true"/>
92                 <patch patchfile="${project.basedir}/src/main/patches/karaf-javax-mail-${karaf.version}.patch"
93                        originalfile="${project.build.directory}/assembly/system/org/apache/karaf/features/standard/${karaf.version}/standard-${karaf.version}-features.xml"
94                        failonerror="true"/>
95                 <copy file="${project.build.directory}/assembly/system/org/apache/karaf/features/standard/${karaf.version}/standard-${karaf.version}-features.xml"
96                       tofile="${project.build.directory}/classes/system/org/apache/karaf/features/standard/${karaf.version}/standard-${karaf.version}-features.xml"/>
97                 <patch patchfile="${project.basedir}/src/main/patches/karaf-paxweb.patch"
98                        originalfile="${project.build.directory}/assembly/system/org/ops4j/pax/web/pax-web-features/4.3.0/pax-web-features-4.3.0-features.xml"
99                        failonerror="true"/>
100                 <copy file="${project.build.directory}/assembly/system/org/ops4j/pax/web/pax-web-features/4.3.0/pax-web-features-4.3.0-features.xml"
101                       tofile="${project.build.directory}/classes/system/org/ops4j/pax/web/pax-web-features/4.3.0/pax-web-features-4.3.0-features.xml"/>
102                 <patch patchfile="${project.basedir}/src/main/patches/karaf-etc-startup-properties-4.0.9.patch"
103                        originalfile="${project.build.directory}/assembly/etc/startup.properties"
104                        failonerror="true"/>
105                 <echo file="${project.build.directory}/assembly/etc/system.properties" append="true">mvn\:org.osgi/org.osgi.service.event/1.3.1 = 8</echo>
106                 <copy file="${project.build.directory}/assembly/etc/startup.properties"
107                       tofile="${project.build.directory}/classes/etc/startup.properties"/>
108                 <fixcrlf srcdir="${project.build.directory}/classes/bin"
109                          includes="*.bat" eol="crlf"/>
110               </target>
111             </configuration>
112           </execution>
113         </executions>
114       </plugin>
115       <plugin>
116         <groupId>org.apache.maven.plugins</groupId>
117         <artifactId>maven-dependency-plugin</artifactId>
118         <executions>
119           <execution>
120             <id>copy</id>
121             <goals>
122               <goal>copy</goal>
123             </goals>
124             <phase>generate-resources</phase>
125             <configuration>
126               <artifactItems>
127                 <!-- Needs to be copied to lib/ext in order to start bouncy provider for mina sshd -->
128                 <artifactItem>
129                     <groupId>org.bouncycastle</groupId>
130                     <artifactId>bcprov-jdk15on</artifactId>
131                     <version>${bouncycastle.version}</version>
132                     <outputDirectory>target/classes/lib/ext</outputDirectory>
133                     <destFileName>bcprov-jdk15on-${bouncycastle.version}.jar</destFileName>
134                 </artifactItem>
135                 <artifactItem>
136                     <groupId>org.bouncycastle</groupId>
137                     <artifactId>bcpkix-jdk15on</artifactId>
138                     <version>${bouncycastle.version}</version>
139                     <outputDirectory>target/classes/lib/ext</outputDirectory>
140                     <destFileName>bcpkix-jdk15on-${bouncycastle.version}.jar</destFileName>
141                 </artifactItem>
142               </artifactItems>
143             </configuration>
144           </execution>
145         </executions>
146       </plugin>
147       <plugin>
148         <groupId>org.codehaus.mojo</groupId>
149         <artifactId>build-helper-maven-plugin</artifactId>
150         <executions>
151           <execution>
152             <id>attach-artifacts</id>
153             <goals>
154               <goal>attach-artifact</goal>
155             </goals>
156             <phase>package</phase>
157             <configuration>
158               <artifacts>
159                 <artifact>
160                   <file>src/main/assembly/etc/org.ops4j.pax.url.mvn.cfg</file>
161                   <type>properties</type>
162                   <classifier>config</classifier>
163                 </artifact>
164               </artifacts>
165             </configuration>
166           </execution>
167         </executions>
168       </plugin>
169       <plugin>
170         <!-- We do this here only so that we can patch a few files,
171              but we then "throw away" (do not package) most of it,
172              as the karaf4-parent will do this again                -->
173         <groupId>org.apache.karaf.tooling</groupId>
174         <artifactId>karaf-maven-plugin</artifactId>
175         <version>${karaf.plugin.version}</version>
176         <executions>
177           <execution>
178             <id>process-resources</id>
179             <phase>process-resources</phase>
180             <goals>
181               <goal>assembly</goal>
182             </goals>
183           </execution>
184       </executions>
185       </plugin>
186       <!-- This needs to execute before patching, otherwise the feature will be left unpatched -->
187       <plugin>
188         <groupId>org.opendaylight.odlparent</groupId>
189         <artifactId>karaf-plugin</artifactId>
190         <version>2.1.0-SNAPSHOT</version>
191         <executions>
192           <execution>
193             <id>populate-local-repo</id>
194             <phase>prepare-package</phase>
195             <goals>
196               <goal>populate-local-repo</goal>
197             </goals>
198             <configuration>
199               <localRepo>${project.build.directory}/assembly/system</localRepo>
200             </configuration>
201           </execution>
202         </executions>
203       </plugin>
204     </plugins>
205   </build>
206 </project>