How to add a version number to war file in web application development? - versioning

I am a beginar of m2e application development by using eclipse(kepler) and my server is jboss 7.1.1 final.I have two war files,one is for client and second is for server .I have an url pattern such as "myproject.com".Now my question is I want to access the data which is present in server war file even I made a changes i.e added the version number to war file for example "Server.war" to "Server0.0.1-SNAPSHOT.war" by using pom.xml file of my project.Would you please explain me what are the changes I need to do in my pom.xml file.
Thanks in advance,
Prasad

I am assuming that you want to keep the same web context despite the war file's name or whatever... In Jboss AS7 you can set the war's context root using the jboss-web.xml deployment descriptor. Just create the file into your_war/WEB-INF folder with this content,
<jboss-web>
<context-root>Server.war</context-root>
</jboss-web>
With maven you can package/install the war using a custom name and concat the version number if you want.
Set a custom name using <finalName> tag inside the build section, for example:
<finalName>ServerAnotherName-${project.version}</finalName>
Removing the tag, the default name will be ${project.artifactId}-${project.version}

Related

Spring Devtools triggers restart when changing excluded files

I have a Spring Boot Web Project that uses Joinfaces and Primefaces. The application extends from SpringBootServletInitializer and also generates a war file.
For development I start my Project (in Eclipse) using RunAs -> Spring Boot App. I've added the spring-boot-devtools dependency as described in the Developer Tools Docu. Everything seems to work, except that changes in a xhtml file also triggers the restart.
I've added the spring.devtools.restart.additional-exclude property in my application.yml to exclude also webapp/**. But this seems to have no effect, because a change still triggers the restart.
spring:
devtools:
restart:
additional-exclude: webapp/**
My Project structure looks like:
src
-main
-java
-resources
-webapp
- *.xhtml
But maybe I do not understand how to use the DevTools correct - Starting the application as Spring Boot App might not be the correct usage? Because if I place a file e.g. foo.txt under src/main/resources and update its content the application is also restarted (using the DevTools defaults (which should exclude /resources)).
Using:
Eclipse Oxygen.3a Release (4.7.3a)
Joinfaces 3.2.1 -> Spring Boot 2.0.2.RELEASE
The solution to my main problem might be relatively easy.
I've added the webapp folder as Source Folder in Eclipse. As soon as I've removed the folder from the list of source folders, the reload was no longer triggered when I changed something in the xhtml files.
This answer gave me the idea, that the source folder might be the problem.
My exclude also did not work. What I did as a workaround is slowing the reload down like this:
poll-interval: 6000
quiet-period: 5000

Error 404 Not Found Loading Bootstrap Glyphicons with Spring MVC

I'm building a maven web application using Spring 3.0.5 MVC, AngularJS 1.5 and Boostrap 3.3.6.
All front-end resources are under webapp/resources/[js,css,fonts].
I've add <mvc:resources mapping="/resources/**" location="/resources/" /> to my spring configuration file.
My issue is that i'm not able to get glyphicons-halflings-regular.xxx files. I got a 404 not found error. (exemple with http://localhost:8080/my-app/resources/fonts/glyphicons-halflings-regular.woff)
I run my app with maven jetty plugin.
any hints?
Thanks in advance
Check that your font files are being copied to the target folder you expect them to be copied to. In your case, you should end up with the *.woff files under ~target/my-app/resources/fonts.
If the files are not in the correct/expected target location, check that you have correctly defined the resources element in your pom, and you're including the *.woff files.
Based on what you've said, I would expect your files to be placed into ~/target/my-app/[js,css,fonts] rather than ~/target/my-app/resources/[js,css,fonts]. If you see them there, then you can either remove the /resources portion of the links, or move the resources under /src/main/resources/resources.
If there are no *.woff files in the target folder at all, check the <resource> element of your pom and make sure you're including all the file types you want. If you need more control, take a look at the copy-resources goal of the maven-resources-plugin here: https://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html
Edit
I just noticed that you put your resources under /src/main/webapp/resources. Since this isn't the standard resource source folder, you can either move the resources into /src/main/resources or add the directory /src/main/webapp/resources to your resource list in the pom.

Angular JS + Laravel 4: How to compile for production mode?

So i have watched the 5 part youtube videos by David Mosher about Angular JS (vids great by the way). In the part 2 (http://www.youtube.com/watch?v=hqAyiqUs93c), it has a practical mysql database usage which I almost wanted.
I'm going to use AngularJS along with Laravel 4, but I had no idea which files I'm going to upload for the web hosting later. I'm trying to run the web app under "/public" folder in my root on localhost (localhost/public/) but the css and js points to the wrong directory (points to the root: '/css/style.css').
Another method I have tried is by copying all the files to the root and moved all files inside "public" to root. Then I navigate to "localhost/public/". All works fine in script paths, except that it doesn't seemed to do any connection to the database (either the laravel or angular failed).
Is there any proper way to do this for practical use (without using php artisan serve or grunt run or lineman run on the server)? Which files I should upload later?
EDIT: the reason is my web hosting doesn't allow me to install nginx or run code remotely using putty, so I need a manual way to do this. Thanks.
First install latest laravel in your localhost. See doc.
Assuming you have completed composer install command.
Then move your all public folder contents to the project root.
Next change the line 21 in index.php from,
require __DIR__.'/../bootstrap/autoload.php';
to
require __DIR__.'/bootstrap/autoload.php';
and line 35 content
$app = require_once __DIR__.'/../bootstrap/start.php';
to
$app = require_once __DIR__.'/bootstrap/start.php';
Now you can access project without public folder.
Place your css, js and other assets folder in root like http://localhost/laravel/css
Note that the laravel blade and angular also using {{ syntax for compilation.So you need to change the laravel blade syntax to {= and =}.Otherwise you will get conflict.
To do this open vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php file and change line 45 to this
protected $contentTags = array('{=', '=}');
and line 52 to this
protected $escapedTags = array('{={', '}=}');
Now you can use {{ for angular and {= for blade.
For linking your assets, use HTMLBuilder functions, see doc here.
Now use these in blade,
{= HTML::style('css/style.css') =} // links localhost/project/css/style.css
{= HTML::script('js/jquery.js') =}
Use migrations and db seeds in localhost and make an exported copy of db for online hosting
After completing project, copy entire project content to online server and change db configuration and import database.
Directory Structure for Online
There will be a public directory for your file hosting, where you put your files in web root.
That may be htdocs or public_html and now it's your project public root.Now the directory structure will be,
-- app
-- bootstrap
-- css
-- images
-- js
-- vendor

Retrieve file relative to play application path

I created a Play! app and deployed it under TomCat. This works well. The only problem is the management of a properties file, currently in the conf folder right next to application.conf. But as soons as the client replaces the war file the custom properties are overwritten with the default values, resulting in errors.
Now I want to introduce a seperate properties file placed inside the webapps folder. This way I will be sure my clients will not overwrite the file 'accidentally'.
So the structure would be:
TomCat webapps:
myPlayApp
PlayConfig <-- here I want to place the config file
So I would like to retrieve the properties file by something like:
getFile("../PlayConfig/app.properties");
This obvious does not work, but I do not know how to achieve this?
I thought retrieving it by tomcat http url but the portnumber my vary, so this would also not work, I guess...
UPDATE 2012-01-25:
Actually when using the following code:
Play.applicationPath.getPath();
I get the absolute path when running the project outside tomcat (so not inside war file!)
When I deploy the same project in a TomCat server I get the following output:
W:\tomcat-5.5\webapps\MyTestProject\WEB-INF\application.
From this point on I can indeed use a relative path.
I think that when deployed in a Servlet container, play uses the /WEB-INF/application as base directory.
Try changing the path relative to this folder.

ubercart file download setting problem

Hi I am using drupal 6.x and ubercart 2.x. I trie dto create a product,but when it comes to add the file download feature I am getting some issue. I put a folder called downloads in the drupal folder and one file inside the download folder.then I gave the path as "drupal/downloads but it is telling that drupal/downloads is not a valid file or directory"
I tied the following file paths too
1.www.mysite.com/drupal/downloads/faq.ods
2.drupal/downloads/faq.ods
3.drupal/faq.ods(after putting faq.ods in the drupal folder.
But still I am getting the same message. Plesae some body help me
It is looking for a path rather than a URL. You should probably aim to find out from your hosting company what the absolute path for your webroot is (e.g. www.mysite.com may actually be on disk as /users/mysite.com/httpdocs) and put in that followed by /drupal/downloads

Resources