Skip to content

Commit 7227cb3

Browse files
committed
updated maven steps
1 parent 52a6b27 commit 7227cb3

3 files changed

Lines changed: 48 additions & 3 deletions

File tree

.github/workflows/publish.yml

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ jobs:
139139
</settings>
140140
EOF
141141
echo "✅ Maven settings.xml configured"
142+
143+
# Verify credentials are set
144+
if [ -z "$SONATYPE_USERNAME" ] || [ -z "$SONATYPE_PASSWORD" ]; then
145+
echo "ERROR: Sonatype credentials not set"
146+
exit 1
147+
fi
148+
echo "✅ Sonatype credentials configured"
142149
143150
- name: Publish to Maven Central
144151
env:
@@ -167,10 +174,46 @@ jobs:
167174
echo "WARNING: GPG signing test failed, but continuing..."
168175
}
169176
177+
# Verify artifacts are built before deploying
178+
echo "Verifying artifacts before deployment..."
179+
mvn clean package -P release \
180+
-Dgpg.keyname="$KEY_ID" \
181+
-Dgpg.passphrase="$GPG_PASSPHRASE" \
182+
-DskipTests
183+
184+
echo "Checking generated artifacts..."
185+
ls -lah target/*.jar target/*.asc target/*.pom 2>/dev/null || echo "No artifacts found in target/"
186+
187+
# Check if version already exists
188+
VERSION=${{ steps.get_version.outputs.version || steps.set_version.outputs.version }}
189+
echo "Checking if version $VERSION already exists..."
190+
if curl -s "https://repo1.maven.org/maven2/io/translateplus/translateplus-java/$VERSION/" | grep -q "$VERSION"; then
191+
echo "⚠️ WARNING: Version $VERSION may already exist on Maven Central"
192+
echo "Continuing anyway (will fail if version truly exists)..."
193+
fi
194+
170195
echo "Publishing to Maven Central..."
171-
mvn clean deploy -P release \
196+
echo "This may take several minutes..."
197+
mvn deploy -P release \
172198
-Dgpg.keyname="$KEY_ID" \
173-
-Dgpg.passphrase="$GPG_PASSPHRASE"
199+
-Dgpg.passphrase="$GPG_PASSPHRASE" \
200+
-X 2>&1 | tee deploy.log || {
201+
echo "=== Deployment failed ==="
202+
echo "=== Last 100 lines of deploy.log ==="
203+
tail -100 deploy.log
204+
echo ""
205+
echo "=== Searching for error messages ==="
206+
grep -i "error\|fail\|exception" deploy.log | tail -50
207+
echo ""
208+
echo "=== Full error trace (last 200 lines) ==="
209+
mvn deploy -P release \
210+
-Dgpg.keyname="$KEY_ID" \
211+
-Dgpg.passphrase="$GPG_PASSPHRASE" \
212+
-e 2>&1 | tail -200
213+
exit 1
214+
}
215+
216+
echo "✅ Deployment completed successfully!"
174217
175218
- name: Verify publication
176219
run: |

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ target/
99
*~
1010
MAVEN_CENTRAL_SETUP.md
1111
GPG_SETUP.md
12+
STEP_BY_STEP_SETUP.md
13+
TROUBLESHOOTING.md

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<configuration>
119119
<publishingServerId>central</publishingServerId>
120120
<autoPublish>true</autoPublish>
121-
<waitUntil>published</waitUntil>
121+
<waitUntil>closed</waitUntil>
122122
</configuration>
123123
</plugin>
124124
</plugins>

0 commit comments

Comments
 (0)