Question

I am using Wabler gem to generate the war file for our Ruby on Rails application. By default, it generates a WAR file named the Rails project home directory name by default.

I would like to know if it is possible to specify custom war file name instead of the default project home directory name.

Thanks Noman A.

Était-ce utile?

La solution

Found answer to my question, so sharing with all who might need it.

File to modify:

warble.rb

For our application, this resides inside [project_dir]/config/

This file would have a section like:

 Warbler::Config.new do |config|
   .....
   .....
 end

Add the following line to specify custom war/jar file name (without extension):

 config.jar_name = "testname"

So, the segment would look like:

 Warbler::Config.new do |config|
   .....
   .....
   config.jar_name = "testname" 
 end

Note: The "...." shown above are not part of the actual configuration, I have replaced original values for example purpose.

Now, when I run warble war/ rake war, it generates war file as "testname.war"

Hope this might help another newbie like me!

Thanks

Noman A.

Autres conseils

Add config/warble.rb file.

Warbler::Config.new do |config|
  config.war_name = "test_war_name"
end

Edit: config.war_name is deprecated, see logged here

# Deprecated
def war_name
  $stderr.puts "config.war_name deprecated; replace with config.jar_name" #:nocov:
  jar_name                  #:nocov:
end

Use the following:

 Warbler::Config.new do |config|
  config.jar_name = "test_war_name"
 end
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top