Where to place the gruntfile in a Spring Web application [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 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.

Related

Android Build process: using aapt on Resource files? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am unsure about the following information from this link that details the Android Build Process.
I am basically wondering why the resource files need to be cnverted to Java source files (first step), then also packaged up to a .ap_ file?
What is the difference between the two steps?
why the resource files need to be cnverted to Java source files
They are not being "cnverted to Java source files". A Java source file -- R.java -- is built using the data from the resources, and that file represents a listing of all of the available resources. This file provides constants for Android app developers to use to refer to these resources from the rest of their Java code.
To draw an analogy, the Web is not "cnverted" to Google's search engine; Google's search engine represents an index of the Web. Similarly, resources are not "cnverted to Java source files" like R.java; R.java represents an index of the resources.

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.

Can I use Overlays in Profile in 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 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

Java - where to put 3rd party JARs and set classpath on Linux [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 6 years ago.
Improve this question
Basically two questions:
1) Where should my third party JARs go? Currently I'm immorally putting them in my application's package, which is immoral e.g. because the third party libs are lower level and should be able to be depended on by all my applications.
2) Where should classpath be set? Tutorials I've seen make it sound like it should be a global variable, but I don't know this because it needs to be project-dependent, i.e. project X needs libraries L and M but project Y needs libraries M and N. Currently I'm just creating a "cp" file for each application but I was wondering if there is a more canonical style.Z
Jars you put into
JAVA_HOME/jre/lib/ext
don't need to be specified in the classpath. So this is useful for libraries you use often like apache-commons for eample.
Rarely used libraries are better called with the classpath.
Setting the classpath depends on your usage, and whether you work on a single user machine, whether it is a client or a server. Many Java apps are made for servers, where you happen to have only one classpath at all.
1> In our project, we have made a 'third-party' project which contains only the third-party jars. The main application is in a separate project which just references to third party project.
So answer to first question may be, create a separate project called 'third-party' and put all your jars there.
2>
Generally, in Linux, you make shell variables and point them to your jars/class files like below:-
# export GWT_HOME=/opt/smartgwt.jar
Then when you invoke Java, can do something like this:-
# java -cp $GWT_HOME <your_main_class>

Add packages to a Tomcat server [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
I'm creating a servlet-based application using Tomcat.
Besides that i've some classes to acces a DB with jdbc. (present in a other folder/package)
I was asking myself how to integrate them cleanly in my servlet-based application.
What's the "cleanest" solution ?
thx
I would go with packaging as a separate JAR file and placing in WEB-INF/lib of your web app.
While it may seem easier to just put JAR to the common libraries folder so that several web apps start using it - it will result in not being able to upgrade the JAR without restarting the whole server. Also you will need to make sure that the new JAR is working fine with all of the apps. Classpath issues are possible with this approach too.
Package them in jar files and then add files to you're project.

Categories