|
157 | 157 | </extensions> |
158 | 158 | </configuration> |
159 | 159 | </plugin> |
160 | | - <plugin> |
161 | | - <groupId>com.googlecode.maven-download-plugin</groupId> |
162 | | - <artifactId>download-maven-plugin</artifactId> |
163 | | - <version>1.13.0</version> |
164 | | - <executions> |
165 | | - <execution> |
166 | | - <id>download-public-suffix-list</id> |
167 | | - <phase>generate-sources</phase> |
168 | | - <goals> |
169 | | - <goal>wget</goal> |
170 | | - </goals> |
171 | | - <configuration> |
172 | | - <url>${cxf.public.suffix.list.url}</url> |
173 | | - <outputDirectory>${project.build.outputDirectory}/mozilla</outputDirectory> |
174 | | - <outputFileName>public-suffix-list.txt</outputFileName> |
175 | | - </configuration> |
176 | | - </execution> |
177 | | - </executions> |
178 | | - </plugin> |
179 | 160 | </plugins> |
180 | | - <pluginManagement> |
181 | | - <plugins> |
182 | | - <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> |
183 | | - <plugin> |
184 | | - <groupId>org.eclipse.m2e</groupId> |
185 | | - <artifactId>lifecycle-mapping</artifactId> |
186 | | - <version>1.0.0</version> |
187 | | - <configuration> |
188 | | - <lifecycleMappingMetadata> |
189 | | - <pluginExecutions> |
190 | | - <pluginExecution> |
191 | | - <pluginExecutionFilter> |
192 | | - <groupId> |
193 | | - com.googlecode.maven-download-plugin |
194 | | - </groupId> |
195 | | - <artifactId> |
196 | | - download-maven-plugin |
197 | | - </artifactId> |
198 | | - <versionRange> |
199 | | - [1.2.0,) |
200 | | - </versionRange> |
201 | | - <goals> |
202 | | - <goal>wget</goal> |
203 | | - </goals> |
204 | | - </pluginExecutionFilter> |
205 | | - <action> |
206 | | - <ignore /> |
207 | | - </action> |
208 | | - </pluginExecution> |
209 | | - </pluginExecutions> |
210 | | - </lifecycleMappingMetadata> |
211 | | - </configuration> |
212 | | - </plugin> |
213 | | - </plugins> |
214 | | - </pluginManagement> |
215 | 161 | </build> |
| 162 | + <profiles> |
| 163 | + <profile> |
| 164 | + <id>online</id> |
| 165 | + <activation> |
| 166 | + <property> |
| 167 | + <!-- Active by default, Inactive with -Doffline --> |
| 168 | + <name>!offline</name> |
| 169 | + </property> |
| 170 | + </activation> |
| 171 | + <build> |
| 172 | + <plugins> |
| 173 | + <plugin> |
| 174 | + <groupId>org.codehaus.gmaven</groupId> |
| 175 | + <artifactId>groovy-maven-plugin</artifactId> |
| 176 | + <executions> |
| 177 | + <execution> |
| 178 | + <id>download-public-suffix-list</id> |
| 179 | + <phase>generate-sources</phase> |
| 180 | + <goals> |
| 181 | + <goal>execute</goal> |
| 182 | + </goals> |
| 183 | + <configuration> |
| 184 | + <!-- Download the suffix file and store it locally only if the content changes --> |
| 185 | + <!-- so that the file timestamp does not change on every build --> |
| 186 | + <source> |
| 187 | + import java.nio.file.Files |
| 188 | + def newContent = new URL(project.properties['cxf.public.suffix.list.url']).text |
| 189 | + String relPath = 'src/main/resources/mozilla/public-suffix-list.txt' |
| 190 | + def destPath = java.nio.file.Path.of(project.properties['project.basedir'] + relPath) |
| 191 | + if (!Files.exists(destPath) || !newContent.equals(destPath.getText('UTF-8'))) { |
| 192 | + Files.createDirectories(destPath.getParent()) |
| 193 | + destPath.setText(newContent.toString(), 'UTF-8') |
| 194 | + println('🚀 Updating ' + relPath) |
| 195 | + } else { |
| 196 | + println('✅ Up to date: ' + relPath) |
| 197 | + } |
| 198 | + </source> |
| 199 | + </configuration> |
| 200 | + </execution> |
| 201 | + </executions> |
| 202 | + </plugin> |
| 203 | + </plugins> |
| 204 | + </build> |
| 205 | + |
| 206 | + </profile> |
| 207 | + </profiles> |
216 | 208 | </project> |
0 commit comments