Dan Timoney | 7f23907 | 2020-06-01 09:28:12 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | if [ $# -ne 3 ] |
| 4 | then |
| 5 | echo "Usage: $0 groupId artifactId version" |
| 6 | exit 1 |
| 7 | fi |
| 8 | |
| 9 | pomGroupId=$1 |
| 10 | pomArtifactId=$2 |
| 11 | pomVersion=$3 |
| 12 | |
| 13 | cat <<END |
| 14 | <?xml version="1.0" encoding="UTF-8"?> |
| 15 | <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"> |
| 16 | <modelVersion>4.0.0</modelVersion> |
| 17 | |
| 18 | <groupId>$pomGroupId</groupId> |
| 19 | <artifactId>$pomArtifactId</artifactId> |
| 20 | <version>$pomVersion</version> |
| 21 | <packaging>pom</packaging> |
| 22 | |
| 23 | <distributionManagement> |
| 24 | <repository> |
| 25 | <id>ecomp-releases</id> |
| 26 | <url>https://nexus.onap.org/content/repositories/releases</url> |
| 27 | </repository> |
| 28 | <snapshotRepository> |
| 29 | <id>ecomp-snapshots</id> |
| 30 | <url>https://nexus.onap.org/content/repositories/snapshots</url> |
| 31 | </snapshotRepository> |
| 32 | </distributionManagement> |
| 33 | |
| 34 | <dependencyManagement> |
| 35 | <dependencies> |
| 36 | END |
| 37 | |
| 38 | |
| 39 | for jar in $(find . -name '*.jar' -print | cut -d'/' -f2- | sort) |
| 40 | do |
| 41 | version=$(echo $jar | rev | cut -d'/' -f2 | rev) |
| 42 | artifactId=$(echo $jar | rev | cut -d'/' -f3 | rev) |
| 43 | groupId=$(echo $jar | rev | cut -d'/' -f4- | rev | tr '/' '.') |
| 44 | |
| 45 | |
| 46 | echo " <dependency>" |
| 47 | echo " <groupId>$groupId</groupId>" |
| 48 | echo " <artifactId>$artifactId</artifactId>" |
| 49 | echo " <version>$version</version>" |
| 50 | echo " </dependency>" |
| 51 | done |
| 52 | |
| 53 | cat <<END |
| 54 | </dependencies> |
| 55 | </dependencyManagement> |
| 56 | </project> |
| 57 | END |