Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add npm-cache goal with self-install mojo. #747

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DanielTuerk
Copy link

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
Copy link
Author

how to fix AppVeyor build?

@Zardoz89
Copy link
Contributor

@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
Copy link
Contributor

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>

@DanielTuerk
Copy link
Author

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?

@Zardoz89
Copy link
Contributor

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.

@eirslett
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants