eirslett / frontend-maven-plugin

"Maven-node-grunt-gulp-npm-node-plugin to end all maven-node-grunt-gulp-npm-plugins." A Maven plugin that downloads/installs Node and NPM locally, runs NPM install, Grunt, Gulp and/or Karma.
Apache License 2.0
4.23k stars 867 forks source link

can't install node, npm, yarn #942

Closed delanym closed 3 years ago

delanym commented 3 years ago

I can't install via the install-node-and-npm or install-node-and-yarn goals on versions since at least 1.7.5

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.10.3:install-node-and-yarn (install node and npm) on project paymentpageswebapps: Execution install node and npm of goal com.github.eirslett:frontend-maven-plugin:1.10.3:install-node-and-yarn failed: A required class was missing while executing com.github.eirslett:frontend-maven-plugin:1.10.3:install-nod e-and-yarn: org/apache/http/protocol/HttpContext [ERROR] -----------------------------------------------------
[ERROR] realm = plugin>com.github.eirslett:frontend-maven-plugin:1.10.3 [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy [ERROR] urls[0] = file:/home/delany/.m2/repository/com/github/eirslett/frontend-maven-plugin/1.10.3/frontend-maven-plugin-1.10.3.jar [ERROR] urls[1] = file:/home/delany/.m2/repository/com/github/eirslett/frontend-plugin-core/1.10.3/frontend-plugin-core-1.10.3.jar [ERROR] urls[2] = file:/home/delany/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.13/jackson-mapper-asl-1.9.13.jar [ERROR] urls[3] = file:/home/delany/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.13/jackson-core-asl-1.9.13.jar [ERROR] urls[4] = file:/home/delany/.m2/repository/org/apache/commons/commons-compress/1.19/commons-compress-1.19.jar [ERROR] urls[5] = file:/home/delany/.m2/repository/commons-io/commons-io/1.3.2/commons-io-1.3.2.jar [ERROR] urls[6] = file:/home/delany/.m2/repository/org/apache/commons/commons-exec/1.3/commons-exec-1.3.jar [ERROR] urls[7] = file:/home/delany/.m2/repository/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar [ERROR] urls[8] = file:/home/delany/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar [ERROR] urls[9] = file:/home/delany/.m2/repository/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar [ERROR] urls[10] = file:/home/delany/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar [ERROR] urls[11] = file:/home/delany/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.3/org.eclipse.sisu.inject-0.3.3.jar [ERROR] urls[12] = file:/home/delany/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar [ERROR] urls[13] = file:/home/delany/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.2/maven-plugin-annotations-3.2.jar [ERROR] urls[14] = file:/home/delany/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar [ERROR] Number of foreign imports: 1 [ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]

    <plugin>
      <groupId>com.github.eirslett</groupId>
      <artifactId>frontend-maven-plugin</artifactId>
      <version>1.10.3</version>
      <!-- <version>1.7.5</version> -->
      <executions>
        <execution>
          <id>install node and npm</id>
          <goals>
            <goal>install-node-and-yarn</goal>
          </goals>
          <phase>generate-resources</phase>
        </execution>
      </executions>
      <configuration>
        <nodeVersion>v4.6.0</nodeVersion>
        <yarnVersion>v0.16.1</yarnVersion>
      </configuration>
    </plugin>

Apache Maven 3.6.3 Maven home: /usr/share/maven Java version: 1.8.0_265, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre Default locale: en_ZA, platform encoding: UTF-8 OS name: "linux", version: "5.4.0-52-generic", arch: "amd64", family: "unix"

Also tried JDK11

Disclaimer: node is already installed on my machine

eirslett commented 3 years ago

That's weird. Try deleting your entire .m2 folder, and then run it again?

delanym commented 3 years ago

I can install after deleting only the .m2/repository

delanym commented 3 years ago

Now its back

delanym commented 3 years ago

It seems your plugin depends on org.apache.httpcomponents:httpclient One of my projects import version 4.5.2 of this artefact into m2/repository But your plugin should mandate the version you need as it clearly won't work with v4.5.2. I did this in the plugin and it now builds.

    <plugin>
      <groupId>com.github.eirslett</groupId>
      <artifactId>frontend-maven-plugin</artifactId>
      <version>1.10.3</version>
      <dependencies>
        <dependency>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient</artifactId>
          <version>4.5.13</version>
        </dependency>
      </dependencies>
jjlharrison commented 3 years ago

This plugin uses 4.5.2: https://github.com/eirslett/frontend-maven-plugin/blob/cdc515af830fb0be5f0a1710c538b7b950fef1f9/frontend-plugin-core/pom.xml#L47

Do you have another project that is polluting your local repository with a modified version of that JAR?

delanym commented 3 years ago

I'll have to look it it more closely. I tried swapping the jar with https://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar I can't remember the exact order of events, but now I can't replicate the issue.

https://github.com/eirslett/frontend-maven-plugin/issues/568