frontend-maven-plugin icon indicating copy to clipboard operation
frontend-maven-plugin copied to clipboard

Add npm-cache goal with self-install mojo.

Open DanielTuerk opened this issue 7 years ago • 6 comments

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>

DanielTuerk avatar Jul 25 '18 07:07 DanielTuerk

how to fix AppVeyor build?

DanielTuerk avatar Sep 18 '18 12:09 DanielTuerk

@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]

Zardoz89 avatar Jan 25 '19 09:01 Zardoz89

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>

Zardoz89 avatar Jan 25 '19 09:01 Zardoz89

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?

DanielTuerk avatar Jan 25 '19 09:01 DanielTuerk

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.

Zardoz89 avatar Jan 29 '19 16:01 Zardoz89

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:

  1. npm mojo with install npm-cache as arguments
  2. Add a npm-cache-install entry to your package.json's scripts section, which runs npm-cache
  3. Use the npm mojo with run npm-cache-install as arguments

Wouldn't that work?

eirslett avatar Jan 30 '19 07:01 eirslett