Skip to content

Commit e3a3523

Browse files
authored
fix: remove unnecessary nexus plugin activation (#2071)
* fix: remove unnecessary nexus plugin activation * declare plugins wrapped by profiles
1 parent c1f3083 commit e3a3523

File tree

6 files changed

+192
-117
lines changed

6 files changed

+192
-117
lines changed

google-http-client-appengine/pom.xml

+16-12
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@
1212
<name>Google App Engine extensions to the Google HTTP Client Library for Java.</name>
1313

1414
<build>
15+
<pluginManagement>
16+
<plugins>
17+
<!--App Engine uses Java 7 and above-->
18+
<plugin>
19+
<groupId>org.codehaus.mojo</groupId>
20+
<artifactId>animal-sniffer-maven-plugin</artifactId>
21+
<configuration>
22+
<signature>
23+
<groupId>org.codehaus.mojo.signature</groupId>
24+
<artifactId>java17</artifactId>
25+
<version>1.0</version>
26+
</signature>
27+
</configuration>
28+
</plugin>
29+
</plugins>
30+
</pluginManagement>
1531
<plugins>
1632
<plugin>
1733
<artifactId>maven-javadoc-plugin</artifactId>
@@ -27,18 +43,6 @@
2743
<plugin>
2844
<artifactId>maven-source-plugin</artifactId>
2945
</plugin>
30-
<!--App Engine uses Java 7 and above-->
31-
<plugin>
32-
<groupId>org.codehaus.mojo</groupId>
33-
<artifactId>animal-sniffer-maven-plugin</artifactId>
34-
<configuration>
35-
<signature>
36-
<groupId>org.codehaus.mojo.signature</groupId>
37-
<artifactId>java17</artifactId>
38-
<version>1.0</version>
39-
</signature>
40-
</configuration>
41-
</plugin>
4246
<plugin>
4347
<groupId>org.apache.maven.plugins</groupId>
4448
<artifactId>maven-dependency-plugin</artifactId>

google-http-client-bom/pom.xml

+57-11
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,22 @@
118118
</dependencies>
119119
</dependencyManagement>
120120
<build>
121+
<pluginManagement>
122+
<plugins>
123+
<plugin>
124+
<groupId>org.sonatype.plugins</groupId>
125+
<artifactId>nexus-staging-maven-plugin</artifactId>
126+
<version>1.7.0</version>
127+
<extensions>true</extensions>
128+
<configuration>
129+
<serverId>sonatype-nexus-staging</serverId>
130+
<nexusUrl>https://google.oss.sonatype.org/</nexusUrl>
131+
<autoReleaseAfterClose>false</autoReleaseAfterClose>
132+
</configuration>
133+
</plugin>
134+
</plugins>
135+
</pluginManagement>
121136
<plugins>
122-
<plugin>
123-
<groupId>org.sonatype.plugins</groupId>
124-
<artifactId>nexus-staging-maven-plugin</artifactId>
125-
<version>1.7.0</version>
126-
<extensions>true</extensions>
127-
<configuration>
128-
<serverId>sonatype-nexus-staging</serverId>
129-
<nexusUrl>https://google.oss.sonatype.org/</nexusUrl>
130-
<autoReleaseAfterClose>false</autoReleaseAfterClose>
131-
</configuration>
132-
</plugin>
133137
<plugin>
134138
<groupId>org.apache.maven.plugins</groupId>
135139
<artifactId>maven-javadoc-plugin</artifactId>
@@ -158,6 +162,48 @@
158162
</build>
159163

160164
<profiles>
165+
<profile>
166+
<!-- By default, we release artifacts to Sonatype, which requires
167+
nexus-staging-maven-plugin. -->
168+
<id>release-sonatype</id>
169+
<activation>
170+
<property>
171+
<!-- Only when we use the release-gcp-artifact-registry profile,
172+
which comes with artifact-registry-url property, this profile is
173+
turned off. -->
174+
<name>!artifact-registry-url</name>
175+
</property>
176+
</activation>
177+
<build>
178+
<plugins>
179+
<plugin>
180+
<groupId>org.sonatype.plugins</groupId>
181+
<artifactId>nexus-staging-maven-plugin</artifactId>
182+
</plugin>
183+
</plugins>
184+
</build>
185+
</profile>
186+
<profile>
187+
<!-- Optionally, we can publish the artifacts to GCP Artifact Registry specifying
188+
this release-gcp-artifact-registry profile:
189+
mvn deploy -P=release-gcp-artifact-registry -P=-release-sonatype \
190+
-Dartifact-registry-url=artifactregistry://us-maven.pkg.dev/...
191+
-->
192+
<id>release-gcp-artifact-registry</id>
193+
<properties>
194+
<artifact-registry-url>artifactregistry://undefined-artifact-registry-url-value</artifact-registry-url>
195+
</properties>
196+
<distributionManagement>
197+
<repository>
198+
<id>gcp-artifact-registry-repository</id>
199+
<url>${artifact-registry-url}</url>
200+
</repository>
201+
<snapshotRepository>
202+
<id>gcp-artifact-registry-repository</id>
203+
<url>${artifact-registry-url}</url>
204+
</snapshotRepository>
205+
</distributionManagement>
206+
</profile>
161207
<profile>
162208
<id>release-sign-artifacts</id>
163209
<activation>

google-http-client-findbugs/pom.xml

+12-7
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,22 @@
1212
<name>Google APIs Client Library Findbugs custom plugin.</name>
1313

1414
<build>
15+
<pluginManagement>
16+
<plugins>
17+
<plugin>
18+
<groupId>org.codehaus.mojo</groupId>
19+
<artifactId>animal-sniffer-maven-plugin</artifactId>
20+
<configuration>
21+
<skip>true</skip>
22+
</configuration>
23+
</plugin>
24+
</plugins>
25+
</pluginManagement>
1526
<plugins>
1627
<plugin>
1728
<artifactId>maven-source-plugin</artifactId>
1829
</plugin>
19-
<plugin>
20-
<groupId>org.codehaus.mojo</groupId>
21-
<artifactId>animal-sniffer-maven-plugin</artifactId>
22-
<configuration>
23-
<skip>true</skip>
24-
</configuration>
25-
</plugin>
30+
2631
<plugin>
2732
<groupId>org.apache.maven.plugins</groupId>
2833
<artifactId>maven-dependency-plugin</artifactId>

pom.xml

+76-62
Original file line numberDiff line numberDiff line change
@@ -287,17 +287,6 @@
287287
<!-- This is the parent, so only define pluginManagement, not plugins. -->
288288
<pluginManagement>
289289
<plugins>
290-
<plugin>
291-
<groupId>org.sonatype.plugins</groupId>
292-
<artifactId>nexus-staging-maven-plugin</artifactId>
293-
<version>1.7.0</version>
294-
<extensions>true</extensions>
295-
<configuration>
296-
<serverId>ossrh</serverId>
297-
<nexusUrl>https://google.oss.sonatype.org/</nexusUrl>
298-
<autoReleaseAfterClose>${deploy.autorelease}</autoReleaseAfterClose>
299-
</configuration>
300-
</plugin>
301290
<plugin>
302291
<artifactId>maven-assembly-plugin</artifactId>
303292
<version>3.7.1</version>
@@ -516,53 +505,6 @@
516505
</plugins>
517506
</configuration>
518507
</plugin>
519-
<plugin>
520-
<groupId>org.codehaus.mojo</groupId>
521-
<artifactId>clirr-maven-plugin</artifactId>
522-
<configuration>
523-
<ignoredDifferencesFile>clirr-ignored-differences.xml</ignoredDifferencesFile>
524-
<logResults>true</logResults>
525-
</configuration>
526-
<executions>
527-
<execution>
528-
<goals>
529-
<goal>check</goal>
530-
</goals>
531-
</execution>
532-
</executions>
533-
</plugin>
534-
<plugin>
535-
<groupId>org.codehaus.mojo</groupId>
536-
<artifactId>animal-sniffer-maven-plugin</artifactId>
537-
<executions>
538-
<execution>
539-
<id>java7</id>
540-
<goals>
541-
<goal>check</goal>
542-
</goals>
543-
<configuration>
544-
<signature>
545-
<groupId>org.codehaus.mojo.signature</groupId>
546-
<artifactId>java17</artifactId>
547-
<version>1.0</version>
548-
</signature>
549-
</configuration>
550-
</execution>
551-
<execution>
552-
<id>android</id>
553-
<goals>
554-
<goal>check</goal>
555-
</goals>
556-
<configuration>
557-
<signature>
558-
<groupId>net.sf.androidscents.signature</groupId>
559-
<artifactId>android-api-level-19</artifactId>
560-
<version>4.4.2_r4</version>
561-
</signature>
562-
</configuration>
563-
</execution>
564-
</executions>
565-
</plugin>
566508
<!-- Build the dependencies report at package time (needed for the assembly artifact). -->
567509
<plugin>
568510
<artifactId>maven-project-info-reports-plugin</artifactId>
@@ -576,10 +518,6 @@
576518
</execution>
577519
</executions>
578520
</plugin>
579-
<plugin>
580-
<groupId>org.sonatype.plugins</groupId>
581-
<artifactId>nexus-staging-maven-plugin</artifactId>
582-
</plugin>
583521
<plugin>
584522
<groupId>com.coveo</groupId>
585523
<artifactId>fmt-maven-plugin</artifactId>
@@ -629,6 +567,82 @@
629567
</properties>
630568

631569
<profiles>
570+
<profile>
571+
<id>clirr-compatibility-check</id>
572+
<!--
573+
CLIRR Maven plugin's dependencies are quite old and not available
574+
in some build environment (Airlock).
575+
https://github.com/googleapis/java-shared-config/issues/956
576+
Extracting this plugin declaration as a profile enables us to disable
577+
the CLIRR dependency resolution by `mvn -P=-clirr-compatibility-check ...`
578+
-->
579+
<activation>
580+
<!-- The compatibility check runs by default in CIs -->
581+
<jdk>[1.8,)</jdk>
582+
</activation>
583+
<build>
584+
<plugins>
585+
<plugin>
586+
<groupId>org.codehaus.mojo</groupId>
587+
<artifactId>clirr-maven-plugin</artifactId>
588+
<configuration>
589+
<ignoredDifferencesFile>clirr-ignored-differences.xml</ignoredDifferencesFile>
590+
<logResults>true</logResults>
591+
</configuration>
592+
<executions>
593+
<execution>
594+
<goals>
595+
<goal>check</goal>
596+
</goals>
597+
</execution>
598+
</executions>
599+
</plugin>
600+
</plugins>
601+
</build>
602+
</profile>
603+
<profile>
604+
<id>animal-sniffer</id>
605+
<activation>
606+
<!-- The compatibility check runs by default in CIs -->
607+
<jdk>[1.7,)</jdk>
608+
</activation>
609+
<build>
610+
<plugins>
611+
<plugin>
612+
<groupId>org.codehaus.mojo</groupId>
613+
<artifactId>animal-sniffer-maven-plugin</artifactId>
614+
<executions>
615+
<execution>
616+
<id>java7</id>
617+
<goals>
618+
<goal>check</goal>
619+
</goals>
620+
<configuration>
621+
<signature>
622+
<groupId>org.codehaus.mojo.signature</groupId>
623+
<artifactId>java17</artifactId>
624+
<version>1.0</version>
625+
</signature>
626+
</configuration>
627+
</execution>
628+
<execution>
629+
<id>android</id>
630+
<goals>
631+
<goal>check</goal>
632+
</goals>
633+
<configuration>
634+
<signature>
635+
<groupId>net.sf.androidscents.signature</groupId>
636+
<artifactId>android-api-level-19</artifactId>
637+
<version>4.4.2_r4</version>
638+
</signature>
639+
</configuration>
640+
</execution>
641+
</executions>
642+
</plugin>
643+
</plugins>
644+
</build>
645+
</profile>
632646
<profile>
633647
<id>java21</id>
634648
<activation>

samples/dailymotion-simple-cmdline-sample/pom.xml

+11-7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
<name>Simple example for the Dailymotion API.</name>
1212

1313
<build>
14+
<pluginManagement>
15+
<plugins>
16+
<plugin>
17+
<groupId>org.sonatype.plugins</groupId>
18+
<artifactId>nexus-staging-maven-plugin</artifactId>
19+
<configuration>
20+
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
21+
</configuration>
22+
</plugin>
23+
</plugins>
24+
</pluginManagement>
1425
<plugins>
1526
<plugin>
1627
<groupId>org.codehaus.mojo</groupId>
@@ -55,13 +66,6 @@
5566
<skip>true</skip>
5667
</configuration>
5768
</plugin>
58-
<plugin>
59-
<groupId>org.sonatype.plugins</groupId>
60-
<artifactId>nexus-staging-maven-plugin</artifactId>
61-
<configuration>
62-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
63-
</configuration>
64-
</plugin>
6569
</plugins>
6670
<finalName>${project.artifactId}-${project.version}</finalName>
6771
</build>

samples/pom.xml

+20-18
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,25 @@
3434
</modules>
3535

3636
<build>
37-
<plugins>
38-
<plugin>
39-
<groupId>org.apache.maven.plugins</groupId>
40-
<artifactId>maven-deploy-plugin</artifactId>
41-
<version>3.1.3</version>
42-
<configuration>
43-
<skip>true</skip>
44-
</configuration>
45-
</plugin>
46-
<plugin>
47-
<groupId>org.sonatype.plugins</groupId>
48-
<artifactId>nexus-staging-maven-plugin</artifactId>
49-
<version>1.7.0</version>
50-
<configuration>
51-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
52-
</configuration>
53-
</plugin>
54-
</plugins>
37+
<pluginManagement>
38+
<plugins>
39+
<plugin>
40+
<groupId>org.apache.maven.plugins</groupId>
41+
<artifactId>maven-deploy-plugin</artifactId>
42+
<version>3.1.3</version>
43+
<configuration>
44+
<skip>true</skip>
45+
</configuration>
46+
</plugin>
47+
<plugin>
48+
<groupId>org.sonatype.plugins</groupId>
49+
<artifactId>nexus-staging-maven-plugin</artifactId>
50+
<version>1.7.0</version>
51+
<configuration>
52+
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
53+
</configuration>
54+
</plugin>
55+
</plugins>
56+
</pluginManagement>
5557
</build>
5658
</project>

0 commit comments

Comments
 (0)