Skip to content

Commit 6e645ef

Browse files
authored
Fix JDK transport mr JAR sources (#1597)
In case of release, the `sources` JAR contained classes. Now, it contains the "notable" (jdk-11) sources, as Java 8 sources are really just a "placeholder" to politely say "we do not work on Java 8" (JDK HttpClient is not available). Fixes #1595
1 parent e048c38 commit 6e645ef

File tree

1 file changed

+62
-10
lines changed
  • maven-resolver-transport-jdk-parent/maven-resolver-transport-jdk

1 file changed

+62
-10
lines changed

maven-resolver-transport-jdk-parent/maven-resolver-transport-jdk/pom.xml

Lines changed: 62 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@
7979
</dependencies>
8080

8181
<build>
82-
<resources>
83-
<resource>
84-
<filtering>false</filtering>
85-
<directory>${project.build.directory}/generated-resources</directory>
86-
</resource>
87-
</resources>
8882
<plugins>
8983
<plugin>
9084
<groupId>org.apache.maven.plugins</groupId>
@@ -110,10 +104,11 @@
110104
<goals>
111105
<goal>unpack-dependencies</goal>
112106
</goals>
113-
<phase>generate-resources</phase>
107+
<phase>prepare-package</phase>
114108
<configuration>
115109
<includeArtifactIds>maven-resolver-transport-jdk-8</includeArtifactIds>
116-
<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
110+
<excludeClassifiers>sources</excludeClassifiers>
111+
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
117112
<excludes>META-INF/maven/**</excludes>
118113
</configuration>
119114
</execution>
@@ -122,15 +117,72 @@
122117
<goals>
123118
<goal>unpack-dependencies</goal>
124119
</goals>
125-
<phase>generate-resources</phase>
120+
<phase>prepare-package</phase>
126121
<configuration>
127122
<includeArtifactIds>maven-resolver-transport-jdk-11</includeArtifactIds>
128-
<outputDirectory>${project.build.directory}/generated-resources/META-INF/versions/11</outputDirectory>
123+
<excludeClassifiers>sources</excludeClassifiers>
124+
<outputDirectory>${project.build.outputDirectory}/META-INF/versions/11</outputDirectory>
129125
<includes>**/*.class</includes>
130126
</configuration>
131127
</execution>
132128
</executions>
133129
</plugin>
134130
</plugins>
135131
</build>
132+
133+
<profiles>
134+
<profile>
135+
<id>apache-release</id>
136+
<dependencies>
137+
<dependency>
138+
<groupId>org.apache.maven.resolver</groupId>
139+
<artifactId>maven-resolver-transport-jdk-11</artifactId>
140+
<version>${project.version}</version>
141+
<classifier>sources</classifier>
142+
<optional>true</optional>
143+
</dependency>
144+
</dependencies>
145+
<build>
146+
<plugins>
147+
<plugin>
148+
<groupId>org.apache.maven.plugins</groupId>
149+
<artifactId>maven-dependency-plugin</artifactId>
150+
<executions>
151+
<execution>
152+
<id>java11-sources</id>
153+
<goals>
154+
<goal>unpack-dependencies</goal>
155+
</goals>
156+
<phase>prepare-package</phase>
157+
<configuration>
158+
<includeArtifactIds>maven-resolver-transport-jdk-11</includeArtifactIds>
159+
<includeClassifiers>sources</includeClassifiers>
160+
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
161+
<includes>**/*.java</includes>
162+
</configuration>
163+
</execution>
164+
</executions>
165+
</plugin>
166+
<plugin>
167+
<groupId>org.codehaus.mojo</groupId>
168+
<artifactId>build-helper-maven-plugin</artifactId>
169+
<executions>
170+
<execution>
171+
<id>add-source</id>
172+
<goals>
173+
<goal>add-source</goal>
174+
</goals>
175+
<phase>prepare-package</phase>
176+
<configuration>
177+
<sources>
178+
<source>${project.build.directory}/generated-sources</source>
179+
</sources>
180+
</configuration>
181+
</execution>
182+
</executions>
183+
</plugin>
184+
</plugins>
185+
</build>
186+
</profile>
187+
</profiles>
136188
</project>

0 commit comments

Comments
 (0)