Closed sansp00 closed 3 years ago
Thank you for letting me know. It seems that the release for some reasons was not propagated to central and published...
In meanwhile, I recommend using the following inclusions in your pom.xml
For jnpm-maven-plugin:
<pluginRepositories>
<pluginRepository>
<id>ossrh.plugins</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</pluginRepository>
</pluginRepositories>
For JMPM as dependency in java:
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
And use 1.1-SNAPSHOT. For example:
<plugin>
<groupId>org.orienteer.jnpm</groupId>
<artifactId>jnpm-maven-plugin</artifactId>
<version>1.1-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>install</goal>
</goals>
<configuration>
<packages>
<package>vue@2.6.11</package>
<package>http-vue-loader@1.4.2</package>
</packages>
<pathPrefix>org/orienteer/vuecket/external</pathPrefix>
<strategy>SIMPLE</strategy>
</configuration>
</execution>
</executions>
</plugin>
or:
<dependency>
<groupId>org.orienteer.jnpm</groupId>
<artifactId>jnpm</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
Thanks for such a quick reply ! The semver librairy seems to be causing problems ...
[ERROR] Failed to execute goal org.orienteer.jnpm:jnpm-maven-plugin:1.1-SNAPSHOT:install (default) on project test-app: Execution default of goal org.orienteer.jnpm:jnpm-maven-plugin:1.1-SNAPSHOT:install failed: Plugin org.orienteer.jnpm:jnpm-maven-plugin:1.1-SNAPSHOT or one of its dependencies could not be resolved: Failed to collect dependencies at org.orienteer.jnpm:jnpm-maven-plugin:jar:1.1-20200801.085225-2 -> org.orienteer.jnpm:jnpm:jar:1.1-SNAPSHOT -> com.github.zafarkhaja:java-semver:jar:0.10.0: Failed to read artifact descriptor for com.github.zafarkhaja:java-semver:jar:0.10.0: Could not transfer artifact com.github.zafarkhaja:java-semver:pom:0.10.0 from/to heisluft-repo (https://heisluft.tk/maven/): Transfer failed for https://heisluft.tk/maven/com/github/zafarkhaja/java-semver/0.10.0/java-semver-0.10.0.pom ProxyInfo{host='127.0.0.1', userName='null', port=9000, type='http', nonProxyHosts='null'}: heisluft.tk:443 failed to respond -> [Help 1]
Building from source fails in a similar fashion
It seems that the repo hosting the lib https://heisluft.tk/maven/ does not 'exists' anymore :(
That's sad... Trying to retarget to original library. Seems that the returned back - so should work. https://github.com/zafarkhaja/jsemver/issues/56 Please give me some time.
On a side note, the lib com.github.zafarkhaja:java-semver does not seem to be maintained anymore (6+ years without updates). Moving to Semver4j or similar maintained lib would ease that pain.
Yea - that's why I used forked version. This one: https://github.com/zafarkhaja/jsemver/issues/56 And this version was located in that custom MVN repository.
@sansp00 , I just pushed migration to Semver4j under #6 . Please let me know if you have any problems. Not sure that republishing version 1.0 makes sense - because people will not have access to jsemver dependency.
Could it be published under a version fix or feature (1.0.1 or 1.1) ? Having your latest enhancements and an official artifact in Central/Bintray would really be helpful for me.
OK. Will figure out why v1.0 was not published before and will push update under v1.1. Will let you know once it will be done.
Figured out the problem: https://github.com/OrienteerBAP/JNPM/commit/eed2bba25f837c36bca266e5b47eb07ee75b9af4 Just pushed version 1.1 to the maven, but it might take several hours for propagation to maven central.
I'm really interested in how are you going to use the library. Please share a few words.
Perfect, I will look into it tomorrow. Thank you for all the work, it is really appreciated. I'm experimenting with the plugin in order to have simpler approach for our builds. The end goal is to produce a web archive with the npm stuff in it using Maven, but due to the way our CI and pipelines are setup, we are unable to easily bridge/combine a NPM workload with Maven. So the idea is to have a pipeline handling a vanilla NPM workload and having another in which, with the help of the plugin to download the npm artifacts, will produce the required web archive (single responsability principle). The current approach requires the full stack tool chain when doing front-end development which is overkill and a PITA to deal with.
@sansp00, sounds very familiar:) If I get you correctly: you want to create a report with used packages in one pipeline and feed it to another one. In this case, I guess, will be helpful if JNMP maven plugin can take a list of packages from outside (not from pom.xml). Am I right? I can add this feature as well.
Btw, 1.1 version is already on maven central.
I've played quite a bit with the plugin this morning. Here is a rundown of my work session:
That being said, after messing with your latest code drop, I was able to poke our internal repository, but I was not able to dump the npm packages to my output directory. Due to time constraint, I did not have time to dig deeper to figure out the culprit.
This plugin shows lot of potential, since there is nothing in Maven, AFAIK, that does not delegate to an npm installation on the machine.
Thank you! Few questions/comments:
I was not able to dump the npm packages to my output directory
. Are you using JNPM as maven or CLI app? Do you consider that as an issue with JNPM? Any exceptions?there is nothing in Maven, AFAIK, that does not delegate to an npm installation on the machine
Yes - that's the main idea of JNPM: avoid NPM installations and do stuff purely in java.
Re,
I am using the Maven plugin exclusively.
I have reworked code:
Regarding your problem: by default JNPM put extracted packages to target/
directory (to be precise: target/jnpm/META-INF
) - so there is no need to commit into git packages itself. But you can easily configure that through extra properties:
jnpm:install
Goal to download, extract and attach npm resources
Available parameters:
attachResources (Default: true)
Attach downloaded resources to the build process
excludes
What has to be excluded from resources to be attached
getDev (Default: false)
Download development dependencies
getOptional (Default: false)
Download optional dependencies
getPeer (Default: false)
Download peer dependencies
getProd (Default: false)
Download direct dependencies
includes
What should be included as resources (Default: empty - means everything)
outputDirectory (Default: ${project.build.directory}/jnpm/)
Location of the output directory
Required: Yes
packages
NPM packages to be downloaded and extracted (For example: vue@2.6.11)
Required: Yes
password
Password for authentication (optional)
pathPrefix
Prefix for the directory under outputDirectory to which files will be
placed
registryUrl (Default: http://registry.npmjs.org/)
NPM registry URL to be used for package lookup and retrieval
strategy (Default: WEBJARS)
Installation strategy to be used
username
Username for authentication (optional)
Example of pom.xml
which perfectly works for me:
<plugin>
<groupId>org.orienteer.jnpm</groupId>
<artifactId>jnpm-maven-plugin</artifactId>
<version>1.2-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>install</goal>
</goals>
<configuration>
<packages>
<package>a@2.1.2</package>
<package>b@2.0.1</package>
</packages>
<excludes>
<exclude>**/package.json</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
Hello @sansp00 , do you have some updates after using recent updates?
Would it be possible to add the publication to maven central or bintray of the different java artifacts (maven plugin and libs) ? I cannot seem to find any of the artifacts on the repos mentionned above. Thank you