Can I use Overlays in Profile in maven? [closed] - java

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Can I use overlays in profile?
I have to build and package my web app such as it has to copy the resources from another project only for specified profile. So How can I achieve this, please suggest some solution.

You don't say what kind of project you're copying from.
If it's a WAR project, then depending on it will cause maven to overlay the resources automatically. So, all you need to do is have a dependencies section in your profile, and within that add a dependency on your other WAR, and maven will overlay it for you.
If it's a jar project, you can zip up your resources using the assembly plugin, and unzip into your war using the dependencies:unpack plugin. I probably can't do better than the accepted answers on these two questions:
Creating a zip archive of the maven "target" directory for how to create the zip of your resources.
Unzip dependency in maven
for how to unzip into your war.
Update: as an alternative to unpacking the zip, you can use the overlays part of the WAR plugin, see the last example on http://maven.apache.org/plugins/maven-war-plugin/overlays.html

i don't think you can run it on com.sun.net.httpserver.HttpServer. because JAX-RS is a specification which have been implemented by various vendors like, Apche,jersey,jboss,spring etc. They provide there own server to run the web services which fulfill the desired criteria.
Although restful web services runs over http but as per me they can't run on com.sun.net.httpserver.HttpServer.
Hope it will help you

We can not use Overlays in Profile, but we can achieve this as shown here Use Overlay with Profile

Related

I don't see the point of Gradle / Maven [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I don't get why would anyone want to use tools like Gradle or Maven, I mean what do they even do? I tried to understand and use them but that got me no where they just unnecessarily complicate things and create a lot of what seems to be absolutely useless files.
So, why bother at all and use these tools and what are they good for?
First of all Gradle and Maven are great tools for managing your dependencies and also giving you the option to simplify your build process. Without these tools you would have to manually download *.jar files. And copy them somewhere in your project folder.
And if you want to update, you would have to open the website again, download it and replace your existing JAR.
Quite often JARs themself have dependencies, so you would have to manually download them as well.
I can understand that the setup of Maven / Gradle at first can be time consuming, but it's usually worth the time since you just have to declare: I need package com.example.package in version 1.2.3 and you just have to run a simple install command and they will take care of downloading everything needed.
Secondly, you can declare commands describing how to run your tests and they will usually take care of your tests not getting mixed up with your final and compiled package.
Also this is good for collaboration because once this config is shared, every developer can use it without going much of a hassle of configuring your development environment. Another good point is that it is independent of any IDE, so your project is not an IntelliJ or Eclipse project and everyone can use the IDE/editor they prefer.
Basically the idea is: You configure it once and then you can enjoy the automatism.
However, if your project is really small and relying on only a few dependencies you might not need it.

How i can build only one JAR-File which is containing several different application/subprojects? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I just want to create several Spring-Boot applications. But I want to create them all in the same project in parallel. At the end, when I'm building all the stuff via maven just one jar-file should be created. One Jar file which is including all applications.
(Optional: not sure if that is even possible) Each project should have its own pom file and artifact id.
To start a particular application of this one jar file, I want to add some profiles (or something similar, special parameter) so that I can simply start a subproject by given parameter or profile.
I just started with the answer i already got. Made the subprojects, but here every subproject is created in an own jar file. That is exactly not what i want ;).
You have an idea?
Tanks a lot in advance.
ps: I'm using IntelliJ IDEA
Yes, you can do it.
For this you can build different individual spring-boot project and accumulate all project into one parent project. Then, you can use your every project individually also can use as a parent jar file.
For more details multi-module-maven spring-boot-multiple-modules

Where to place the gruntfile in a Spring Web application [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm not sure where is the best is to place my Grunt file in my spring web application. Should it be placed at the root of the web application like so:
my-app/gruntfile.js
Or should I place it at the root of resource directory like so:
my-app/src/main/webapp/static
Both will work. Just wondering what's the best practice here. Thanks!
I think a good project structure for spring and a client side library like AngularJS is:
my-app/src/
* main
* client: gruntfile.js, bower.json, js and html files
* java: spring java code
* resources: application.properties, static folder (for compiled client)
I would also take a look at some generators such as
http://yeoman.io/ or http://jhipster.github.io/
which create new projects with best practices and tools.
The grunt file is usually not part of the deployable. So it should not be src/main/webapp folder.I usually place my gulp file (pretty mutch the same thing) in the project root folder.
If you plan do minify or compile with grunt. You usually need a folder for the original files and one for the compiled files. My experience is that it is a bad idea to compile the files directly into the src/main/webapp folder since IDE's track them and reindex them every time. So I integrated gulp into the gradle lifecycle and copy all files into the webapp folder when I create the deployable.

How to use java library not supplied as a jar [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am programming a YouTube-Downloader, and I'd like to use the 2 libraries VGet and WGet, since no other library worked. How do I embed those into my project? I'm using IntelliJ 14.
As noted at the bottom on the pages of those two libraries, the libraries are available on Maven Central.
You could search on Maven for "com.github.axet", e.g. http://search.maven.org/#search%7Cga%7C1%7Ccom.github.axet
Then you'll see the vget and wget libraries. By clicking on the latest version, you come to a page where there is also a jar-file to be downloaded.
But please be aware: Both libraries require additional libraries (e.g. some of the Apache commons libs), which you'll need as well. It is thus highly recommended, to use a dependency management tool like Maven, Ivy or Gradle for your project. I don't know IntelliJ that good, but at least Maven should be supported out of the box. Then all you have to do is specify that you want to use wget and vget, and libraries used by wget or vget will be automatically added to your classpath as well.

application server integration into development process [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Aloha,
I am currently doing my Master thesis in writing an internal Web Application. I'm pretty much starting from scratch. Of course there are some requirements but those are not too important for my question.
Giving the case that there will be further development/maintenance when I'm finished with the thesis from 4-6 developers.
What I've done in previous projects/assignments was installing the Application Server (AS) by hand (setting it up etc.) on my developer machine.
What I've done as well is to use Maven to install and configure something like Jetty/Tomcat and the other developers just have to get the Maven project, run mvn install and their good to go.
But what will you do with an AS like Wildfly?
My Question would be is there any best practice for handling an AS in a team from 4-6 developers? (AS just on developer machines, not Devevelopment/Quality/Production systems)
You have 4 options if you considering the Wildfly as your AS
Include your modified standalone.xml inside your project, maybe in src/main/resources/ folder, every developer can pull it through Git or whatever VCS are you using.
You can create CLI script for a Wildfly and include it to your code base again. You can find some tutorial on the internet, for instance here. The advantage over XML is that you don't have to modify source manually, script can be executed as a batch which means it will either configure everything correctly or leave it intact.
Configure Wildfly through the Maven plugin. You can run there same commands as in option 2, some example can be seen here.
You can also upload a modified ZIP with your server to some location and make every developer use this version. Downside is that everybody will have to download this ZIP again if you make any modifications to the configuration.
So I think option number 3 is the best (because it's most automated and it's easiest to spread the configuration change among all developers) however your pom.xml can get really bloated with configuration. In this case, you can combine it with option number 2 so the Maven plugin will just ran the CLI script file from inside of your project.

Categories