Skip to content

Commit 62eb125

Browse files
DSouzaMdnestoro
authored andcommitted
Use common repo instead of local repo
1 parent 95dcb07 commit 62eb125

File tree

3 files changed

+47
-22
lines changed

3 files changed

+47
-22
lines changed

DEVELOPING.md

+43-18
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,18 @@ For the Maven plugin, simply use the `mvnDebug` command in place of the `mvn` co
4646
## Testing Local Changes with an Existing Project
4747
A common development task is to modify a plugin and then test it with an existing project.
4848

49-
To do this, first modify the project as necessary, and then build and publish the plugins to the local Maven repository:
49+
To do this, first modify the project as necessary, and then build and publish the plugins:
5050
```bash
51-
./gradlew publishToMavenLocal --no-parallel
51+
./gradlew publishAllPublicationsToCommonRepository --no-parallel
5252
```
53+
The above command publishes to a "common" repository located at `build/common-repo`.
5354

54-
Next, update the plugin version string in the project build files.
55-
The version can be found manually by searching for the published artifacts in `~/.m2/repository/org/graalvm/buildtools/native/`, or alternatively by checking the `nativeBuildTools` property [here](gradle/libs.versions.toml).
55+
Next, update the project build files:
56+
1. Update the version string. The version can be found manually by searching for the published artifacts in `~/.m2/repository/org/graalvm/buildtools/native/`, or alternatively by checking the `nativeBuildTools` property [here](gradle/libs.versions.toml).
57+
2. Update the list of repositories to include and prioritize the common repo.
5658

57-
For Gradle, the change looks like the following.
58-
You may also need to direct Gradle to use the local Maven repository to resolve the plugin:
59+
### Gradle
60+
Make the following changes to the build files:
5961
```bash
6062
# build.gradle
6163
plugins {
@@ -64,25 +66,48 @@ You may also need to direct Gradle to use the local Maven repository to resolve
6466
+ id 'org.graalvm.buildtools.native' version '0.10.5-SNAPSHOT'
6567
}
6668

67-
repositories {
68-
+ mavenLocal()
69+
repositories {
70+
+ maven {
71+
+ name = "common"
72+
+ url = "$NATIVE_BUILD_TOOLS_ROOT/build/common-repo"
73+
+ }
6974
...
7075
}
7176

7277
# settings.gradle
73-
pluginManagement {
74-
repositories {
75-
+ mavenLocal()
76-
...
77-
}
78-
}
78+
pluginManagement {
79+
repositories {
80+
+ maven {
81+
+ name = "common"
82+
+ url = "$NATIVE_BUILD_TOOLS_ROOT/build/common-repo"
83+
+ }
84+
# NB: If repositories were not specified before, declaring the common
85+
# repo will overwrite the default repository; you may also need to
86+
# declare that repository explicitly.
87+
mavenCentral()
88+
...
89+
}
90+
}
7991
```
92+
Then, run the Gradle command as usual.
8093
81-
For Maven, simply bump the version and it should try the local repository automatically:
94+
### Maven
95+
Make the following changes to pom.xml:
8296
```bash
8397
# pom.xml
84-
- <native.maven.plugin.version>0.9.25</native.maven.plugin.version>
85-
+ <native.maven.plugin.version>0.10.5-SNAPSHOT</native.maven.plugin.version>
98+
<project ...>
99+
<properties>
100+
- <native.maven.plugin.version>0.9.25</native.maven.plugin.version>
101+
+ <native.maven.plugin.version>0.10.5-SNAPSHOT</native.maven.plugin.version>
102+
</properties>
103+
...
104+
+ <pluginRepositories>
105+
+ <pluginRepository>
106+
+ <id>common</id>
107+
+ <url>file://$NATIVE_BUILD_TOOLS_ROOT/build/common-repo</url>
108+
+ </pluginRepository>
109+
+ </pluginRepositories>
110+
</project>
86111
```
87112
88-
Then, run your build as usual. Gradle/Maven should find the plugin in the local repository and use it for the build.
113+
Then, run the Maven command with the `-U` flag to force Maven to use an updated snapshot (e.g., `mvn -Pnative package -U`).

native-gradle-plugin/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ End-user documentation about the plugins can be found [here](https://graalvm.git
99
This plugin can be built with this command (from the root directory):
1010

1111
```bash
12-
./gradlew :native-gradle-plugin:publishToMavenLocal --no-parallel
12+
./gradlew :native-gradle-plugin:publishAllPublicationsToCommonRepository --no-parallel
1313
```
1414

15-
For more details, see the [Developer documentation](../DEVELOPING.md).
15+
A snapshot will be published to `build/common-repo`. For more details, see the [Developer documentation](../DEVELOPING.md).
1616

1717
In order to run testing part of this plugin you need to get (or build) corresponding `junit-platform-native` artifact.
1818

native-maven-plugin/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ End-user documentation about the plugins can be found [here](https://graalvm.git
99
This plugin can be built with this command (from the root directory):
1010

1111
```bash
12-
./gradlew :native-maven-plugin:publishToMavenLocal --no-parallel
12+
./gradlew :native-maven-plugin:publishAllPublicationsToCommonRepository --no-parallel
1313
```
1414

15-
For more details, see the [Developer documentation](../DEVELOPING.md).
15+
A snapshot will be published to `build/common-repo`. For more details, see the [Developer documentation](../DEVELOPING.md).
1616

1717
*You can also take a look at CI workflow [here](../.github/workflows/test-native-maven-plugin.yml).*

0 commit comments

Comments
 (0)