Skip to content

Commit

Permalink
Allow publishing to SNAPSHOT area
Browse files Browse the repository at this point in the history
Configure pom and script so that repo.eclipse.org can be used when
deploying snapshots
  • Loading branch information
mickaelistria committed Jul 4, 2022
1 parent c33b20c commit 5ecb7a4
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 45 deletions.
16 changes: 10 additions & 6 deletions publish-to-maven-central/jdt-pom.xml
Expand Up @@ -11,12 +11,16 @@
<gpg.key.id>B414F87E</gpg.key.id>
</properties>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</snapshotRepository>
</distributionManagement>
<distributionManagement>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>repo.eclipse.org</id>
<url>https://repo.eclipse.org/content/repositories/eclipse-snapshots/</url>
</snapshotRepository>
</distributionManagement>

<build>
<plugins>
Expand Down
16 changes: 10 additions & 6 deletions publish-to-maven-central/pde-pom.xml
Expand Up @@ -11,12 +11,16 @@
<gpg.key.id>86085154</gpg.key.id>
</properties>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</snapshotRepository>
</distributionManagement>
<distributionManagement>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>repo.eclipse.org</id>
<url>https://repo.eclipse.org/content/repositories/eclipse-snapshots/</url>
</snapshotRepository>
</distributionManagement>

<build>
<plugins>
Expand Down
16 changes: 10 additions & 6 deletions publish-to-maven-central/platform-pom.xml
Expand Up @@ -11,12 +11,16 @@
<gpg.key.id>CC641282</gpg.key.id>
</properties>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</snapshotRepository>
</distributionManagement>
<distributionManagement>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>repo.eclipse.org</id>
<url>https://repo.eclipse.org/content/repositories/eclipse-snapshots/</url>
</snapshotRepository>
</distributionManagement>

<build>
<plugins>
Expand Down
25 changes: 16 additions & 9 deletions publish-to-maven-central/publishJDT.sh
Expand Up @@ -42,9 +42,6 @@ cp -r ${REPO}/${JDT}/* ${JDT}/

echo "==== UPLOAD ===="

URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
REPO=ossrh
SETTINGS=/home/jenkins/.m2/settings-deploy-ossrh-jdt.xml
MVN=/opt/tools/apache-maven/latest/bin/mvn

/bin/mkdir .log
Expand Down Expand Up @@ -76,29 +73,39 @@ function same_as_baseline() {

for pomFile in org/eclipse/jdt/*/*/*.pom
do
if same_as_baseline $pomFile
then
xmllint --xpath "/*[local-name()='project']/*[local-name()='version']" $file | grep SNAPSHOT
snapshot=$?
if [ $snapshot == 0 ]; then
URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
REPO=ossrh
SETTINGS="-s /home/jenkins/.m2/settings-deploy-ossrh-jdt.xml"
else
URL=https://repo.eclipse.org/content/repositories/eclipse-snapshots/
REPO=repo.eclipse.org
fi

if same_as_baseline $pomFile; then
echo "Skipping file $pomFile which is already present in the baseline"
else
file=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1.jar|"`
sourcesFile=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1-sources.jar|"`
javadocFile=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1-javadoc.jar|"`

echo "${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file -Durl=${URL} -DrepositoryId=${REPO} -Dfile=${file} -DpomFile=${pomFile}"
echo "${MVN} -f jdt-pom.xml ${SETTINGS} gpg:sign-and-deploy-file -Durl=${URL} -DrepositoryId=${REPO} -Dfile=${file} -DpomFile=${pomFile}"

${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
${MVN} -f jdt-pom.xml ${SETTINGS} gpg:sign-and-deploy-file \
-Durl=${URL} -DrepositoryId=${REPO} \
-Dfile=${file} -DpomFile=${pomFile} \
>> .log/artifact-upload.txt

echo -e "\t${sourcesFile}"
${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
${MVN} -f jdt-pom.xml ${SETTINGS} gpg:sign-and-deploy-file \
-Durl=${URL} -DrepositoryId=${REPO} \
-Dfile=${sourcesFile} -DpomFile=${pomFile} -Dclassifier=sources \
>> .log/sources-upload.txt

echo -e "\t${javadocFile}"
${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
${MVN} -f jdt-pom.xml ${SETTINGS} gpg:sign-and-deploy-file \
-Durl=${URL} -DrepositoryId=${REPO} \
-Dfile=${javadocFile} -DpomFile=${pomFile} -Dclassifier=javadoc \
>> .log/javadoc-upload.txt
Expand Down
25 changes: 16 additions & 9 deletions publish-to-maven-central/publishPDE.sh
Expand Up @@ -42,9 +42,6 @@ cp -r ${REPO}/${PDE}/* ${PDE}/

echo "==== UPLOAD ===="

URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
REPO=ossrh
SETTINGS=/home/jenkins/.m2/settings-deploy-ossrh-pde.xml
MVN=/opt/tools/apache-maven/latest/bin/mvn

/bin/mkdir .log
Expand Down Expand Up @@ -76,29 +73,39 @@ function same_as_baseline() {

for pomFile in org/eclipse/pde/*/*/*.pom
do
if same_as_baseline $pomFile
then
xmllint --xpath "/*[local-name()='project']/*[local-name()='version']" $file | grep SNAPSHOT
snapshot=$?
if [ $snapshot == 0 ]; then
URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
REPO=ossrh
SETTINGS="-s /home/jenkins/.m2/settings-deploy-ossrh-pde.xml"
else
URL=https://repo.eclipse.org/content/repositories/eclipse-snapshots/
REPO=repo.eclipse.org
fi

if same_as_baseline $pomFile; then
echo "Skipping file $pomFile which is already present in the baseline"
else
file=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1.jar|"`
sourcesFile=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1-sources.jar|"`
javadocFile=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1-javadoc.jar|"`

echo "${MVN} -f pde-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file -Durl=${URL} -DrepositoryId=${REPO} -Dfile=${file} -DpomFile=${pomFile}"
echo "${MVN} -f pde-pom.xml ${SETTINGS} gpg:sign-and-deploy-file -Durl=${URL} -DrepositoryId=${REPO} -Dfile=${file} -DpomFile=${pomFile}"

${MVN} -f pde-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
${MVN} -f pde-pom.xml ${SETTINGS} gpg:sign-and-deploy-file \
-Durl=${URL} -DrepositoryId=${REPO} \
-Dfile=${file} -DpomFile=${pomFile} \
>> .log/artifact-upload.txt

echo -e "\t${sourcesFile}"
${MVN} -f pde-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
${MVN} -f pde-pom.xml ${SETTINGS} gpg:sign-and-deploy-file \
-Durl=${URL} -DrepositoryId=${REPO} \
-Dfile=${sourcesFile} -DpomFile=${pomFile} -Dclassifier=sources \
>> .log/sources-upload.txt

echo -e "\t${javadocFile}"
${MVN} -f pde-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
${MVN} -f pde-pom.xml ${SETTINGS} gpg:sign-and-deploy-file \
-Durl=${URL} -DrepositoryId=${REPO} \
-Dfile=${javadocFile} -DpomFile=${pomFile} -Dclassifier=javadoc \
>> .log/javadoc-upload.txt
Expand Down
25 changes: 16 additions & 9 deletions publish-to-maven-central/publishPlatform.sh
Expand Up @@ -43,9 +43,6 @@ cp -r ${REPO}/${PLATFORM}/* ${PLATFORM}/

echo "==== UPLOAD ===="

URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
REPO=ossrh
SETTINGS=/home/jenkins/.m2/settings-deploy-ossrh-releng.xml
MVN=/opt/tools/apache-maven/latest/bin/mvn

/bin/mkdir .log
Expand Down Expand Up @@ -77,29 +74,39 @@ function same_as_baseline() {

for pomFile in org/eclipse/platform/*/*/*.pom
do
if same_as_baseline $pomFile
then
xmllint --xpath "/*[local-name()='project']/*[local-name()='version']" $file | grep SNAPSHOT
snapshot=$?
if [ $snapshot == 0 ]; then
URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
REPO=ossrh
SETTINGS="-s /home/jenkins/.m2/settings-deploy-ossrh-releng.xml"
else
URL=https://repo.eclipse.org/content/repositories/eclipse-snapshots/
REPO=repo.eclipse.org
fi

if same_as_baseline $pomFile; then
echo "Skipping file $pomFile which is already present in the baseline"
else
file=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1.jar|"`
sourcesFile=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1-sources.jar|"`
javadocFile=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1-javadoc.jar|"`

echo "${MVN} -f platform-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file -Durl=${URL} -DrepositoryId=${REPO} -Dfile=${file} -DpomFile=${pomFile}"
echo "${MVN} -f platform-pom.xml ${SETTINGS} gpg:sign-and-deploy-file -Durl=${URL} -DrepositoryId=${REPO} -Dfile=${file} -DpomFile=${pomFile}"

${MVN} -e -X -f platform-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
${MVN} -e -X -f platform-pom.xml ${SETTINGS} gpg:sign-and-deploy-file \
-Durl=${URL} -DrepositoryId=${REPO} \
-Dfile=${file} -DpomFile=${pomFile} \
>> .log/artifact-upload.txt

echo -e "\t${sourcesFile}"
${MVN} -e -X -f platform-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
${MVN} -e -X -f platform-pom.xml ${SETTINGS} gpg:sign-and-deploy-file \
-Durl=${URL} -DrepositoryId=${REPO} \
-Dfile=${sourcesFile} -DpomFile=${pomFile} -Dclassifier=sources \
>> .log/sources-upload.txt

echo -e "\t${javadocFile}"
${MVN} -e -X -f platform-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
${MVN} -e -X -f platform-pom.xml ${SETTINGS} gpg:sign-and-deploy-file \
-Durl=${URL} -DrepositoryId=${REPO} \
-Dfile=${javadocFile} -DpomFile=${pomFile} -Dclassifier=javadoc \
>> .log/javadoc-upload.txt
Expand Down

0 comments on commit 5ecb7a4

Please sign in to comment.