forked from IntershopCommunicationsAG/nexus-setup-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_repositories.sh
executable file
·40 lines (30 loc) · 1.24 KB
/
create_repositories.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# File : create-repositories.sh
# Desc : Creates Nexus repositories for Intershop project setup
# Author: the
# TODO: Adjust settings to your needs
NexusUrl="http://nexus:8081"
NexusUser="admin"
NexusPwd="********"
# May be we need to delete existing repos
#for repo in components jcenter central ishrepo distributions releases snapshots
#do
#curl -u $NexusUser:$NexusPwd -X DELETE \
# -H "accept: application/json" -H 'Content-Type: application/json' \
# "$NexusUrl/service/rest/v1/repositories/$repo"
#done
# Create proxy repositories
for data in jcenter central ishrepo
do
curl -u $NexusUser:$NexusPwd -H "accept: application/json" -H 'Content-Type: application/json' \
"$NexusUrl/service/rest/v1/repositories/maven/proxy" -d @jsonrepos/$data.json
done
# Create hosted repositories
for data in distributions releases snapshots
do
curl -u $NexusUser:$NexusPwd -H "accept: application/json" -H 'Content-Type: application/json' \
"$NexusUrl/service/rest/v1/repositories/maven/hosted" -d @jsonrepos/$data.json
done
# Create 'components' group repositories
curl -u $NexusUser:$NexusPwd -H "accept: application/json" -H 'Content-Type: application/json' \
"$NexusUrl/service/rest/v1/repositories/maven/group" -d @jsonrepos/components.json