by SupLockDef · 6mo ago · 0 comments
Maven doesn't have "preinstall, install, post install", or " build.rs" for rust, executing arbitrary code during the installation.
The code that's executing with Maven is in your pom.xml, not some hidden code from a transient dependency.
That alone is a major design flaw in both npm and cargo.
Java is boring, because it works. People don't like boring stuff. It's more exciting to play the Russian roulette on each install!
Especially the number of times I had to clean all the caches in order for maven and gradle to build the project is just far too high for me. It shouldn’t ever be needed if an ecosystem is meant to be considered boring. I feel like Java doesn’t build when I look at it wrong.
Hah, too true! I guess it is boring in the fact that it is not as... move fast and break things... as NPM. But Java build systems are still certainly fun and challenging in their own ways.
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<version>3.5.1</version>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>Generate-shared-lib</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>bash</executable>
<arguments>
<argument>generate-lib.sh</argument>
</arguments>
<environmentVariables>
<JAVA_HOME>${env.JAVA_HOME}</JAVA_HOME>
</environmentVariables>
</configuration>
</execution>
</executions>
</plugin>
At least with certain plug-ins Maven will execute arbitrary commands at build time. And if you need that to build native bindings it feels like a big hole. Granted, most projects don't need JNI, I guess.