frontend-maven-plugin
frontend-maven-plugin copied to clipboard
Add npm-cache goal with self-install mojo.
Summary
Use the npm-cache plugin to cache the "node_modules" of the projects in the local file system. That could be used for large projects which are build by jenkins with the "wipe workspace" option.
The plugin will be installed automatically for the local npm if not existing.
Tests and Documentation
The Output should not change, just the output of "npm" will change to "npm-cache" and for each build the node_modules are packed and stored to the local file system.
Tested for OSX and Linux. Maven 3.5
Example:
<execution>
<id>npm install</id>
<goals>
<goal>npm-cache</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
how to fix AppVeyor build?
@DanielTuerk I think that it's error on appveyour configuration. It's not specific to this PR.
Looks that can't reach the maven repository where download oss-parent
See :
[INFO] Scanning for projects... Downloading: https://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent-7.pom [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project com.github.eirslett:frontend-plugins:1.7-SNAPSHOT (C:\projects\frontend-maven-plugin\pom.xml) has 1 error [ERROR] Non-resolvable parent POM: Could not transfer artifact org.sonatype.oss:oss-parent:pom:7 from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version and 'parent.relativePath' points at wrong local POM @ line 4, column 13 -> [Help 2]
See : https://stackoverflow.com/questions/22243566/cant-find-oss-parent-7-jar
Looks that it's necessary to edit the ~/.m2/settings.xml and add a repository
According to the jest readme on github, you need to add the sonatype maven repository:
<repositories>
<repository>
<id>sonatype</id>
<name>Sonatype Groups</name>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
See : https://stackoverflow.com/questions/22243566/cant-find-oss-parent-7-jar
Looks that it's necessary to edit the ~/.m2/settings.xml and add a repository
According to the jest readme on github, you need to add the sonatype maven repository:
<repositories> <repository> <id>sonatype</id> <name>Sonatype Groups</name> <url>https://oss.sonatype.org/content/groups/public/</url> </repository> </repositories>
I think we can just add the repo to the POM of the project. That would fix all builds. Would you like to try it in a new PR?
I think that @eirslett it's overload or very busy. I would like to send an email asking if I can help him with the AppVeyour stuff and to close a version of this plugin. I configured AppVeyour for C++ projects some time ago, so I have little idea of how works.
Sorry for the late reply - I'm indeed quite overloaded. And I no longer work in an organization that uses this plugin. But I think what you want to achieve can be solved using the existing version of the plugin, without creating a new mojo. I'm reluctant to add new features, because it adds technical debt, and most likely won't be maintained by anybody once it's merged (at least that's my experience.)
I suggest that you set up your Maven config like this:
npmmojo withinstall npm-cacheas arguments- Add a
npm-cache-installentry to yourpackage.json'sscriptssection, which runsnpm-cache - Use the
npmmojo withrun npm-cache-installas arguments
Wouldn't that work?