Attach sources to fat jar to improve no-build IDE experience (#892)

pull/894/head
Michael Barry 2024-05-23 06:03:21 -04:00 zatwierdzone przez GitHub
rodzic f4fcb16599
commit 3680df633d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
5 zmienionych plików z 34 dodań i 33 usunięć

Wyświetl plik

@ -57,10 +57,10 @@ jobs:
# Skip spotless since that gets checked in a separate task
- name: Build with mvnw (linux/mac)
if: ${{ !contains(matrix.os, 'windows') }}
run: ./mvnw ${{matrix.args}} -Dspotless.check.skip --batch-mode -no-transfer-progress package verify jib:buildTar --file pom.xml
run: ./mvnw ${{matrix.args}} -Dspotless.check.skip --batch-mode -no-transfer-progress verify jib:buildTar --file pom.xml
- name: Build with mvnw.cmd (windows)
if: ${{ contains(matrix.os, 'windows') }}
run: mvnw.cmd ${{matrix.args}} -Dspotless.check.skip --batch-mode -no-transfer-progress package verify jib:buildTar --file pom.xml
run: mvnw.cmd ${{matrix.args}} -Dspotless.check.skip --batch-mode -no-transfer-progress verify jib:buildTar --file pom.xml
shell: cmd
examples:

Wyświetl plik

@ -47,7 +47,7 @@
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<version>1.19.0</version>
<version>${jts.version}</version>
</dependency>
<dependency>
<groupId>org.tukaani</groupId>

Wyświetl plik

@ -24,6 +24,7 @@ import java.nio.channels.ClosedChannelException;
import java.nio.channels.SeekableByteChannel;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.concurrent.NotThreadSafe;
/**
* A {@link SeekableByteChannel} implementation that wraps a byte[].
@ -38,8 +39,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
* </p>
*
* @since 1.13
* @NotThreadSafe
*/
@NotThreadSafe
public class SeekableInMemoryByteChannel implements SeekableByteChannel {
private static final int NAIVE_RESIZE_LIMIT = Integer.MAX_VALUE >> 1;

Wyświetl plik

@ -48,6 +48,19 @@
<artifactId>planetiler-examples</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- Add sources to the jar to improve IDE experience when using jar with deps -->
<dependency>
<groupId>com.onthegomap.planetiler</groupId>
<artifactId>planetiler-core</artifactId>
<version>${project.parent.version}</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<version>${jts.version}</version>
<classifier>sources</classifier>
</dependency>
</dependencies>
<build>

45
pom.xml
Wyświetl plik

@ -22,6 +22,7 @@
<maven.source.excludeResources>true</maven.source.excludeResources>
<jackson.version>2.17.1</jackson.version>
<junit.version>5.10.2</junit.version>
<jts.version>1.19.0</jts.version>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>onthegomap</sonar.organization>
<sonar.projectKey>onthegomap_planetiler</sonar.projectKey>
@ -262,6 +263,21 @@
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
<goal>test-jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
@ -309,22 +325,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
<goal>test-jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
@ -405,19 +405,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
<goal>test-jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>