2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
12 # Uses wget to fetch a project's maven-metadata.xml files from a Maven repository.
14 # Ensure we fail the job if any steps fail.
17 project=$(xmlstarlet sel \
18 -N "x=http://maven.apache.org/POM/4.0.0" -t \
19 --if "/x:project/x:groupId" \
20 -v "/x:project/x:groupId" \
21 --elif "/x:project/x:parent/x:groupId" \
22 -v "/x:project/x:parent/x:groupId" \
24 project_path="${project//.//}"
26 mkdir -p "$WORKSPACE/m2repo/$project_path"
27 pushd "$WORKSPACE/m2repo/$project_path"
28 # Temporarily disable failing for wget
29 # If 404 happens we don't care because it might be a new project.
31 wget -nv --recursive \
32 --accept maven-metadata.xml \
34 --execute robots=off \
36 --no-host-directories \
37 --cut-dirs="$NEXUS_CUT_DIRS" \
38 "$NEXUS_URL/content/repositories/$NEXUS_REPO/$project_path/"
42 # Backup metadata - Used later to find metadata files that have not been modified
43 mkdir -p "$WORKSPACE/m2repo-backup"
44 cp -a "$WORKSPACE/m2repo/"* "$WORKSPACE/m2repo-backup"