No problem, as all is working for now I am not asking for any help, just
boasting because you've said this could be interesting.
But I made a project with these files, see
https://github.com/fedd/mavenwithnpm
On 15.04.2019 17:23, Geertjan Wielenga wrote:
Sorry, this is no way to work together on this. Put an app with this
structure on GitHub or somewhere similar so that we can take a look
together, please.
Gj
On Mon, 15 Apr 2019 at 09:31, Fedd <f...@sql.ru <mailto:f...@sql.ru>>
wrote:
Thanks though it doesn't work very stable as it turned out...
The goal is just to have a mavenized jar that can be referenced in
other project's pom and make all javascript artifacts available to
it. I made npm scripts that are run by maven so that I build all
javascripts with the Netbeans build button, found examples on the net:
package.json part:
"scripts": {
"bundle": "webpack"
},
webpack conf part (I keep javascripts in a special folder between
an empty "java" and a git-ignored "webapp" folders, the latter
gets recreated upon every build):
entry: {
dela: './src/main/js/dela.js',
process: './src/main/js/process.js'
},
output: {
path: __dirname + '/src/main/webapp',
filename: '[name].js'
},
...
plugins: [
new CleanWebpackPlugin(),
new CopyWebpackPlugin([
// some project specific artifacts to copy like styles
and fonts
])
]
pom.xml part (the only addition to the pom that was created by new
project wizard):
<build>
<resources>
<resource>
<!-- webapp is used as a webpack output directory
because NetBeans
activates NPM tooling when this direcotry is
present, so why not?
but now we have to copy this to the res directory
in the jar's root -->
<directory>src/main/webapp</directory>
<targetPath>res</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>npm install (initialize)</id>
<goals>
<goal>exec</goal>
</goals>
<phase>initialize</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm install (clean)</id>
<goals>
<goal>exec</goal>
</goals>
<phase>pre-clean</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm config list (validate)</id>
<goals>
<goal>exec</goal>
</goals>
<phase>validate</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>config</argument>
<argument>list</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm run bundle (compile)</id>
<goals>
<goal>exec</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>bundle</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
On 15.04.2019 16:18, Geertjan Wielenga wrote:
You may have found a (the) way to combine Java, Maven,
JavaScript, and NPM. If so, that’s amazing.
Gj
On Mon, 15 Apr 2019 at 08:56, Fedd <f...@sql.ru
<mailto:f...@sql.ru>> wrote:
Thanks, some Netbeans module has updated (I think it was
called "Local Tasks") and the package.json editor has retured.
There is nothing special in my project. To reproduce success
scenario, one may just create a new "Java with Maven / Java
Application", in Files window go to the src/main folder and
create a new one called "webapp". Then go to the Project
Properties (right click the project root and then
"Properties") and see that in JavaScript Category there are
three items, "npm", "Bower" and some other. "npm" is what I
was missing. Now it's there again. Thank you the developers! =)
fedd
On 15.04.2019 15:02, Geertjan Wielenga wrote:
It is hard to know what your project looks like or contains.
But however you have opened it, you’ll see all its content
in the Files window. If you can put a project that looks
like this (or ideally is) this project on GitHub so that we
can look at it, that will help.
Gj
On Mon, 15 Apr 2019 at 03:32, Fedd <f...@sql.ru
<mailto:f...@sql.ru>> wrote:
Hello,
I desperately need to have an ability to work with NPM
libraries in a
Maven non-webapp project, but NetBeans decides not to
show the
JavaScript libraries project property menu in order not
to confuse me (?)
Again, this is neither a HTML5/JavaScript project nor
"Java with Maven /
Web Application". It is "Java with Maven / Java
Application" and I just
want to edit my package.json with what we have for doing
this in web
projects.
How do I activate the Javascript Libraries in the Java
Maven Project
properties window? I confirm that I thought well and I
do need this.
At first it looked like that the presence of webapp
directory in
"src/main" made Netbeans to show the desired submenu,
but then it
somehow stopped working, I have rolled back most of my
changes, but
NetBeans is still outsmarting me.
Is there any magic configuration file entry?
My SO question regarding this with pictures:
https://stackoverflow.com/questions/50932323/list-npm-libraries-in-netbeans-8-2-maven-java-non-web-app-project
Regards,
Fyodor
---------------------------------------------------------------------
To unsubscribe, e-mail:
users-unsubscr...@netbeans.apache.org
<mailto:users-unsubscr...@netbeans.apache.org>
For additional commands, e-mail:
users-h...@netbeans.apache.org
<mailto:users-h...@netbeans.apache.org>
For further information about the NetBeans mailing
lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists