Maven war plugin overlays and eclipse - maven-plugin

I am using overlays for adding war dependencies. I have to exclude one jar from parent war lib before packaging war again. added excludes for overlays.
It works fine if I deploy the application using maven/Gradle script, But it fails as soon as I deploy from eclipse.
Reason: overlays unpack parent war in folder war/work and it has got all the lib. Eclipse is using this folder.
Is there any way I can fix this problem.

Related

MSIX Include Additional Required Files

I have a simple WinForms app that I'm trying to package with MSIX. The app itself requires additional files that when I build the MSIX App Project doesn't copy/include.
Specifically this LIBVLC folder that gets included during the WinForms app build itself.
If I manually copy that folder over into the AppX build folder, everything works. Obviously I'm trying to automate including that folder.
Folder manually copied over in screenshot below:
How can I accomplish this? GitHub minimal repo:
https://github.com/aherrick/MSIXWinFormsLIBVLC
I suspect that this line is your issue : https://github.com/aherrick/MSIXWinFormsLIBVLC/blob/0e717828a16e796a7a27e415cf45d33a50327da9/MSIXWinFormsLIBVLC.AppPackage/MSIXWinFormsLIBVLC.AppPackage.wapproj#L80
The nuget package isn't really well understood by the build tools as those are native files that we collect "before build". It seems to cause issues when a project references a project that references the nuget package, and the usual workaround is to reference the nuget package directly in the topmost project.
Is it possible to reference a nuget package in a .wapproj ?
If it isn't, that's an issue for this repository https://code.videolan.org/videolan/libvlc-nuget/ . Contributions welcome

Netbeans JSF - Creating executable JAR file

I'm working at the moment on an JSF Project project. Everything is working fine. Creating .war-file, deploying it.
What I actually want is, to create a executable JAR-file for a single Class. In this Class I have a Main-method that sends an email after executing it.
I the past I have worked with Eclipse. And that was very easy.
Now I am working with Netbeans. I have red a lot of posts with the information to clean and build the project. Next to that checking the .dist folder for the JAR-files.
I have either the .dist folder, or any JAR-files in my Project folder for that correlate file.
How can I easily create that JAR-file in Netbeans?
Assuming you are using a native NetBeans project rather than Maven:
The build artefact of a project is defined by it's project type. A JSB/Web project is always build into a WAR file.
If there is one class in your project that you want to put into a JAR file, the clean solution would be to create a new "Java" project with that class (as your class clearly has no dependencies to your Web Application this should work).
For such a project NetBeans will automatically create a runnable JAR file if you configure the main method.
In your JSF project you can simply include that project as a library. If you enable "Build projects on classpath", the jar will automatically be build when you build the web application.
Another approach would be to customize the Ant script NetBeans uses internally and add a target that builds your executable JAR file from that single class.
Details on how to customize the IDE generated Ant script can be found in the manual:
https://docs.oracle.com/netbeans/nb82/netbeans/NBDAG/create_japps.htm#CHDDAHEB

How upload reactjs project to ftp?

I'm newbie on react, I did 2 paged website for exercise, all is working well on my localhost.
But i'm confused about how upload project to my linux server.
What i did ?
I create react app via terminal with this command :
create-react-app react-demo-project
Terminal create my project and in project root i have node_modules directory.
so here is i have some questions:
1- React project will work normally on linux hosting?
2- I need to all my project upload to ftp? Because there is arround 20.000 file in node_modules directory.
With this command build your app :
npm run build
Build folder has created in your project directory, open index.html in your browser and check output...
If you saw a blank page (after build and opening index.html) , you must change the main js file path in the index.html :
default is : src="/static/js/main.ddfa624a.js"
change to : src="./static/js/main.ddfa624a.js"
I changed js path and this worked !
create-react-app has a command to bundle your app to a ready to deploy state.
npm run build
This command will bundle your app in /build folder. With the contents of this folder you can deploy your app in any hosting environment. You don't need to install your packages and libraries manually when you use this command. More information about using this command and deploying your app in different hosting environments can be found create-react-app README
Deployment
npm run build creates a build directory with a production build of
your app. Set up your favorite HTTP server so that a visitor to your
site is served index.html, and requests to static paths like
/static/js/main.<hash>.js are served with the contents of the
/static/js/main.<hash>.js file.
1- React project will work normally on linux hosting?
Yes, it will work in all webservers, unless you have server side rendering (SSR)
2- I need to all my project upload to ftp? Because there is arround
20.000 file in node_modules directory.
Files in node_modules will NOT go to your web server. These are development dependency files used only during development.
Run npm run build
This will create a folder called build in project root. This will have all html, css , images and js files
Copy all files and folders in build folder to your site root.
If your site has to be hosted in a sub folder in root you need to do the below, otherwise you will see a blank page. This is because your static files (css, js etc) are not loaded correctly.
Open package.json
Add a new entry homepage: /your_subfolder/
It will look like this
Now do steps mentioned above and your site should work fine
Add this line to package.json:
"homepage": "./"
That should make it work without the need to adjust index.html after every build.

easing the gradle build process in deploying spring boot and angular js application

I am working on gradle based spring boot and angularjs project. I have all my angularjs code in static folder which is committed to Git. We need to deploy it into a server which does not have access to internet. So I have generated dist contents using gulp serve:dist and replaced the contents in the static folder with the contents of dist folder. Then I have generated jar file and deployed in server.
So it is becoming manually cumbersome every time to replace the contents of static folder with the contents of dist generating jar file then removing the dist folder contents from static folder and then replacing it with original angular js code.
Is there any possibility to generate the jar file directly using the contents from dist folder instead using the contents in static folder?
I am not sure whether I made the problem clear or not. Please update me if you need any further clarification.
If you are using Spring Boot with standalone JAR deployment, you just need to output front-end assets into src/main/resources/static and Spring Boot will serve them via embedded container.
You can use Gradle Gulp Plugin to execute Gulp build as task within main Gradle build.
Reaction on comment:
Mentioned static folder of course contains only assets you intend to serve by Spring Boot. It wouldn't contain code or anything else. You can have your code in e.g. [projectRoot]/jsSrc. Just Gulp needs to know where to find these files.
We are using such directory structure without any problems (with CI build running on every commit). If manual action is needed to build project, your build is fundamentally broken. In this case your issue is misplaced JS source files.

Maven Plugin Working Directory Not Constant

I wrote a Maven Plugin that creates some XML files on the classpath of my project. The Maven Project is fairly complex and has one master project with many sub projects (think services for a larger application).
The plugin takes a directory argument in the pom.xml, which is something relative to the classpath like this:
<docDestination>src/main/webapp/static/</docDestination>
However, when I try to access this folder via new File(docDestination), the resulting directory depends on the project (or sub-project) from which I ran the mvn install command that triggered the plugin.
The plugin is only specified in the pom.xml of one of the sub-projects, but if I run mvn-install from the parent it creates the XML files in the src/main/... folder of the parent application. How do I get the plugin to use the filesystem of the project in which it is declared rather than the filesystem of the parent project?
I should note that if I navigate to the sub-project in Terminal and run mvn install in that directory the files are created in the right place, which explains the title of my post.
Use the ${basedir} variable:
<docDestination>${basedir}/src/main/webapp/static</docDestination>
This should use the basedir currently used by the respective module (regardless of whether this is the top-level or a sub-module).

Resources