Skip to content

Commit c7de168

Browse files
authored
Build empty javadoc and sources jars for azure-spring-cloud-starter-appconfiguration-config (Azure#29019)
* build empty javadoc and sources jars * Fix the plugin configuration
1 parent 52282d9 commit c7de168

File tree

1 file changed

+75
-0
lines changed
  • sdk/appconfiguration/azure-spring-cloud-starter-appconfiguration-config

1 file changed

+75
-0
lines changed

sdk/appconfiguration/azure-spring-cloud-starter-appconfiguration-config/pom.xml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,79 @@
2626
<version>2.6.0-beta.1</version><!-- {x-version-update;com.azure.spring:azure-spring-cloud-feature-management-web;current} -->
2727
</dependency>
2828
</dependencies>
29+
<build>
30+
<plugins>
31+
<!-- START: Empty Java Doc and Sources -->
32+
<!-- The following code will generate an empty javadoc with just a README.md. This is necessary
33+
to pass the required checks on Maven. The way this works is by setting the classesDirectory
34+
to a directory that only contains the README.md, which we need to copy. If the classesDirectory
35+
is set to the root, where the README.md lives, it still won't have javadocs but the jar file
36+
will contain a bunch of files that shouldn't be there. The faux sources directory is deleted
37+
and recreated with the README.md being copied every time to guarantee that, when building locally,
38+
it'll have the latest copy of the README.md file.
39+
-->
40+
<plugin>
41+
<groupId>org.apache.maven.plugins</groupId>
42+
<artifactId>maven-jar-plugin</artifactId>
43+
<version>3.1.2</version> <!-- {x-version-update;org.apache.maven.plugins:maven-jar-plugin;external_dependency} -->
44+
<executions>
45+
<execution>
46+
<id>empty-javadoc-jar-with-readme</id>
47+
<phase>package</phase>
48+
<goals>
49+
<goal>jar</goal>
50+
</goals>
51+
<configuration>
52+
<classifier>javadoc</classifier>
53+
<classesDirectory>${project.basedir}/javadocTemp</classesDirectory>
54+
</configuration>
55+
</execution>
56+
<execution>
57+
<id>empty-source-jar-with-readme</id>
58+
<phase>package</phase>
59+
<goals>
60+
<goal>jar</goal>
61+
</goals>
62+
<configuration>
63+
<classifier>sources</classifier>
64+
<classesDirectory>${project.basedir}/sourceTemp</classesDirectory>
65+
</configuration>
66+
</execution>
67+
</executions>
68+
</plugin>
69+
<plugin>
70+
<groupId>org.apache.maven.plugins</groupId>
71+
<artifactId>maven-antrun-plugin</artifactId>
72+
<version>1.8</version> <!-- {x-version-update;org.apache.maven.plugins:maven-antrun-plugin;external_dependency} -->
73+
<executions>
74+
<execution>
75+
<id>copy-readme-to-javadocTemp-and-sourceTemp</id>
76+
<phase>prepare-package</phase>
77+
<configuration>
78+
<target>
79+
<echo>Deleting existing ${project.basedir}/javadocTemp and
80+
${project.basedir}/sourceTemp</echo>
81+
<delete includeEmptyDirs="true" quiet="true">
82+
<fileset dir="${project.basedir}/javadocTemp"/>
83+
<fileset dir="${project.basedir}/sourceTemp"/>
84+
</delete>
85+
<echo>Copying ${project.basedir}/../README.md to
86+
${project.basedir}/javadocTemp/README.md
87+
</echo>
88+
<copy file="${project.basedir}/../README.md" tofile="${project.basedir}/javadocTemp/README.md" failonerror="false"/>
89+
<echo>Copying ${project.basedir}/../README.md to
90+
${project.basedir}/sourceTemp/README.md
91+
</echo>
92+
<copy file="${project.basedir}/../README.md" tofile="${project.basedir}/sourceTemp/README.md" failonerror="false"/>
93+
</target>
94+
</configuration>
95+
<goals>
96+
<goal>run</goal>
97+
</goals>
98+
</execution>
99+
</executions>
100+
</plugin>
101+
<!-- END: Empty Java Doc and Sources -->
102+
</plugins>
103+
</build>
29104
</project>

0 commit comments

Comments
 (0)