Giter VIP home page Giter VIP logo

Comments (17)

gabor-farkas avatar gabor-farkas commented on May 28, 2024 7

Changing "npm" to "npm.cmd" solved the issue for me

from exec-maven-plugin.

dym-ok avatar dym-ok commented on May 28, 2024 7

I guess the easiest way is to remove npm file (shell script) on Windows, so that it will find npm.cmd.
Makes no sense to have a Windows-specific command line in pom.xml.

from exec-maven-plugin.

fjakop avatar fjakop commented on May 28, 2024 4

We use the same POM in Windows and Linux, if I changed this, it would not run under Linux anymore.

from exec-maven-plugin.

khmarbaise avatar khmarbaise commented on May 28, 2024

Are you running on win32 based system (Windows XP or 32 Bit version of Windows 7 ?)

from exec-maven-plugin.

fjakop avatar fjakop commented on May 28, 2024

My environment is

Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00)
Maven home: D:\Programme\Java\apache-maven-3.3.3
Java version: 1.8.0_40, vendor: Oracle Corporation
Java home: D:\Programme\Java\java-8.0.40-win64-jdk\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"

I'm running maven from cmd prompt and of course npm install from the same cmd works fine.

from exec-maven-plugin.

khmarbaise avatar khmarbaise commented on May 28, 2024

Have you seen the error message:

CreateProcess error=193, %1 ist keine zulässige Win32-Anwendung

from exec-maven-plugin.

fjakop avatar fjakop commented on May 28, 2024

Yes I did, but calling the same from cmd promt works well and with version 1.5.0 also.

from exec-maven-plugin.

khmarbaise avatar khmarbaise commented on May 28, 2024

So with version 1.5.0 it works without any issue? have you tried to add the extension like (.exe ?)

from exec-maven-plugin.

fjakop avatar fjakop commented on May 28, 2024

Sorry typo, with 1.4.0 all is good, just switching version to 1.5.0 makes things break.

from exec-maven-plugin.

fjakop avatar fjakop commented on May 28, 2024

That may be, but it does not clarify, why it worked in 1.4.0...

from exec-maven-plugin.

gabor-farkas avatar gabor-farkas commented on May 28, 2024

@fjakop true, I forgot about that, I'll also need this to run on jenkins and peer developers machines.

from exec-maven-plugin.

mkarg avatar mkarg commented on May 28, 2024

The proposed fix works only on Windows, but will break Linux as it enforces the existence of file extensions, and the existence of the variable PATHEXT. Please correct it: Don't remove the top fast-success case, but make it conditional for non-Windows instead.

from exec-maven-plugin.

hohwille avatar hohwille commented on May 28, 2024

Could you set a milestone (1.6.0?) or label so people can understand why this is closed?

from exec-maven-plugin.

Prophet32j avatar Prophet32j commented on May 28, 2024

when is 1.6.0 getting added to Maven central?

from exec-maven-plugin.

amwebexpert avatar amwebexpert commented on May 28, 2024

See this which solve the problem through profiles: http://stackoverflow.com/a/39407412/704681

from exec-maven-plugin.

d0x7 avatar d0x7 commented on May 28, 2024

I know this is really old, but: The SO answer says it's fixed, but it doesn't seem to be. If I rename remove the npm file so that there is only npm.cmd left, it works with <executable> set to npm. But if it exists, it breaks (with 'C:\Program' is not recognized as an internal or external command, operable program or batch file.). Setting npm.cmd as the command is not an option for me. Profile would work, but I'd rather get this fixed really this time, than having another workaround.

So, is this a new or different bug or am I missing something?

from exec-maven-plugin.

mkarg avatar mkarg commented on May 28, 2024

@d0x7 I cannot reproduce your problem. I have set up a complete example from scratch on Windows 11 (64 Bit) and it worked for me out of the box using a fake npm.cmd batch file which simply prints all given paramters to STDOUT:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>eu.headcrashing</groupId>
    <artifactId>exec-42</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <properties>
        <npm.registry>C:\foo\bar</npm.registry>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>npm install</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>npm</executable>
                            <commandlineArgs>install --registry ${npm.registry}</commandlineArgs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
mvn package
...
[INFO] --- exec-maven-plugin:3.1.0:exec (npm install) @ exec-42 ---
install --registry C:\foo\bar

This works as shown above without any other changes or tricks if npm.cmd lives in the current working directory or if it is found on the Windows search path PATH. It also should work perfectly using totally different / arbitrary locations of npm.cmd as once as you specify that path using a toolchain.

I am sorry that it does not work for you, but apparently there seems to be something different in your case, so please tell us what that difference is.

from exec-maven-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.