Skip to content

Commit

Permalink
Attach sources to fat jar to improve no-build IDE experience (#892)
Browse files Browse the repository at this point in the history
  • Loading branch information
msbarry authored May 23, 2024
1 parent f4fcb16 commit 3680df6
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion planetiler-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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[].
Expand All @@ -38,8 +39,8 @@
* </p>
*
* @since 1.13
* @NotThreadSafe
*/
@NotThreadSafe
public class SeekableInMemoryByteChannel implements SeekableByteChannel {

private static final int NAIVE_RESIZE_LIMIT = Integer.MAX_VALUE >> 1;
Expand Down
13 changes: 13 additions & 0 deletions planetiler-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
45 changes: 16 additions & 29 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 3680df6

Please sign in to comment.