allegro / grunt-maven-plugin

Grunt + Maven integration done right
Other
213 stars 32 forks source link

npm ERR! install Couldn't read dependencies #81

Open amicos opened 9 years ago

amicos commented 9 years ago

I have this issue when i do : mvn install

npm ERR! install Couldn't read dependencies

ERR! errno -4058

ERR! package.json ENOENT, open 'C:\workspace\MyProject\package.json' ERR! package.json This is most likely not a problem with npm itself. ERR! package.json npm can't find a package.json file in your current directory

My Pom File:

 <build>    
       <plugins>
             <plugin>
                    <groupId>pl.allegro</groupId>
                <artifactId>grunt-maven-plugin</artifactId>
             <version>1.5.0</version>
             <configuration>
                  <jsSourceDirectory>${basedir}/src/main/webapp/app</jsSourceDirectory>
                <sourceDirectory>${basedir}/src/main/webapp</sourceDirectory>
                <npmEnvironmentVar>
                    <PHANTOMJS_CDNURL> http://cnpmjs.org/downloads
                                            </PHANTOMJS_CDNURL>
                </npmEnvironmentVar>
                <filteredResources>
                    <filteredResource>maven-properties.json</filteredResource>
                </filteredResources>
                <workingDirectory>${basedir}/src/main/webapp</workingDirectory>
                </configuration>
            <executions>
                <execution>
                    <id>test-angular</id>
                    <phase>test</phase>
                    <configuration>
                        <target>test</target>
                    </configuration>
                    <goals>
                        <goal>create-resources</goal>
                        <goal>npm</goal>
                        <goal>grunt</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <webResources>
                    <resource>
                        <directory>${basedir}/src/main/webapp/dist</directory>
                    </resource>
                </webResources>
            </configuration>
        </plugin>

    </plugins>
</build>

how to specify the path of package.json and gruntfile to the plugin because my pom isnt in the same repesitory (the pom is in the default root of project and all the others files are in webapp)? who can help me please?

amicos commented 9 years ago

I'm stuck on it

adamdubiel commented 9 years ago

Can you show tree of your project? and mark where you need your package.json to reside in.

amicos commented 9 years ago

The tree of my project: MyProject ├── src ------├── main ------------├──webapp ------------------├──app ------------ -----------├──projects scripts and files ------------------------├── index.html ------------------├──dist ------------------├── test ------------------├──WEB-INF ------------------├── GruntFile.js ------------------├──package.json
├──pom.xml

I want my pom to build my project to have in final the war

adamdubiel commented 9 years ago

I guess the formatting is wrong - can you edit it so i can see the indentations?

adamdubiel commented 9 years ago

Okay, i guess you need to add some more formatting to your pom as well, as i can't see the whole.

amicos commented 9 years ago

I do it

adamdubiel commented 9 years ago

Okay, sto there are two problems:

amicos commented 9 years ago

I modify the Pom :

< jsSourceDirectory> ${basedir}/src/main/webapp </ jsSourceDirectory>

but I have this issue :

error errno -4058 error package.json ENOENT, open 'C:\workspace\JcdstreamIhm\target-grunt\package.json' error package.json This is most likely not a problem with npm itself. error package.json npm can't find a package.json file in your current directory. verbose exit [ -4058, true ]

adamdubiel commented 9 years ago

I don't know what did you change - can you shod the relevant bits?

amicos commented 9 years ago

< jsSourceDirectory> ${basedir}/src/main/webapp </ jsSourceDirectory>

in the webapp I have the GruntFile.js and package.json

adamdubiel commented 9 years ago

As i mentioned earlier, jsSourceDriectory should contain relative path, just change it it app - if your gruntfile and package.json are in app.

amicos commented 9 years ago

Ok I use the relative path. I want to build my project and generate the war. do you think the goals I used are enough to reach my target. Thanks

adamdubiel commented 9 years ago

If your configuration (i.e. npm works) is okay, that should be enough.