[jnigen] Support Maven version 4 (https://github.com/dart-lang/jnigen/issues/261)
From version 4 Maven throws an error if we use descriptorId as we
should be using descriptorRef instead.
descriptorRef also works with Maven 3.
To enable support for Maven 4 we have changed the Maven command used
to build ApiSummarizer.jar from 'mvn assembly:assembly` to
`mvn compile`.
Jnigen/java's README contains instructions for manually building
ApiSummarizer.jar. These instructions need to be updated to use
the new maven commands 'mvn compile' and 'mvn test'.
diff --git a/pkgs/jnigen/java/README.md b/pkgs/jnigen/java/README.md
index f304059..50c8ab4 100644
--- a/pkgs/jnigen/java/README.md
+++ b/pkgs/jnigen/java/README.md
@@ -8,7 +8,7 @@
## Build
When using it via `jnigen`, the `jnigen:setup` script will take care of building the jar in appropriate location.
-To build the jar manually, run `mvn assembly:assembly` in project root. The jar will be created in `target/` directory.
+To build the jar manually, run `mvn compile` in project root. To build the jar and run the tests as well, run `mvn test`. The jar will be created in `target/` directory.
## Command line
```
diff --git a/pkgs/jnigen/java/pom.xml b/pkgs/jnigen/java/pom.xml
index 2ca3916..89c5a9e 100644
--- a/pkgs/jnigen/java/pom.xml
+++ b/pkgs/jnigen/java/pom.xml
@@ -44,6 +44,22 @@
<build>
<directory>${buildDir}/target</directory>
<finalName>ApiSummarizer</finalName>
+ <pluginManagement><!-- Lock down plugins versions to avoid using Maven defaults -->
+ <plugins>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>3.2.0</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>3.3.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>3.3.0</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -53,8 +69,11 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
+ <version>3.5.0</version>
<configuration>
- <descriptorId>jar-with-dependencies</descriptorId>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
@@ -62,6 +81,15 @@
</manifest>
</archive>
</configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/pkgs/jnigen/lib/src/tools/build_summarizer.dart b/pkgs/jnigen/lib/src/tools/build_summarizer.dart
index 5d5a7ef..1e0ec06 100644
--- a/pkgs/jnigen/lib/src/tools/build_summarizer.dart
+++ b/pkgs/jnigen/lib/src/tools/build_summarizer.dart
@@ -29,11 +29,11 @@
final pom = pkg.resolve('java/pom.xml');
await Directory(toolPath).create(recursive: true);
final mvnArgs = [
+ 'compile',
'--batch-mode',
'--update-snapshots',
'-f',
pom.toFilePath(),
- 'assembly:assembly'
];
log.info('execute mvn ${mvnArgs.join(" ")}');
try {