Discussion on the technology of Ant's own function realizing automatic discovering system parameter value

Source: Internet
Author: User
Keywords System parameter values
Tags address aliyun apache app application application server automatic basic

In this paper, we will discuss the technique of using Ant's own function to realize the parameter value of the automatic discovery system.

Apache Ant is widely used in the process of automated compilation, packaging, and deployment of Java development. When using ANT for a package deployment, you often need to enter some system environment parameters, such as host name, IP address, configuration file path for some services, and some http://www.aliyun.com/zixun/aggregation/18477.html "> system service ports, and so on. The values of these system parameters are usually different depending on the environment in which they are deployed, so the use of ANT scripts for deployment in different environments requires manual input of these parameter values. A generic ant deployment script places parameters that require user input into the configuration property file, so that you can run the ant script each time the users modify the configuration files.

However, in some repetitive scenarios, such as software development, testing process, each deployment manually to configure the system parameters, is undoubtedly a waste of human resources. In this paper, we will discuss the technique of using Ant's own function to realize the parameter value of the automatic discovery system.

Classification of system parameters

In a system environment that uses an ANT script for deployment, there are several types of system parameters that are commonly used:

Basic parameters of the operating system

such as host name, domain name, system user name and password, etc.

Application Server Parameters

such as Web server installation path, profile path, Java Server installation path, application instance name, Web service port, database server installation path, JDBC driver path, and so on

Application itself parameters

For example, the name of the module to be deployed, the path, the database records used, and so on

In these parameters, the operating system basic parameters vary depending on the server being used, for example, administrator users are typically root in the UNIX system, and in Windows systems, the host name and IP address are different for each server. ; Application server parameters vary depending on the operating system in which they are installed, as well as the habits of the people who install them, such as the habit of modifying the installation directory to/USR and others liking opt; As for the parameters of the application itself when it repeats the deployment, there is basically not much difference.

So when we work with the Ant script for repeated deployments, the parameters that are often required to be manually modified are operating system basic parameters and application server parameters. The following is an example of a configured property file, and as we can see, every time we deploy on a different server, on a different operating system, many of the parameters in the property file need to be modified, and once the error or omission is corrected, the deployment may fail.

Listing 1. Deploy.properties file

server.host=test.mycompany.com Admin.user=administrator Admin.pass=adminpassword Was.home=C:/WebSphere/AppServer Ejb.module.list=project-server Web.module.list=projectserviceshttpinterface App.home=c:/websphere/apphome App.instance.name=demo Was.profile.name=${app.instance.name} was.server.name=server1 Was.conntype=SOAP was.port= 9066 db.type=db2 Db.name=demo Jdbc.url=jdbc:db2://test.mycompany.com:50000/demo jdbc.driver= Com.ibm.db2.jcc.DB2Driver jdbc.driver.path=c:/websphere/sqllib/java/db2jcc4.jar;\ C:/websphere/sqllib/java/db2jcc_license_cu.jar Datasource.jndi.name=jdbc/app DB2 DataSource ${app.instance.name}

So what are the parameters that can be automatically discovered and set up by Ant itself?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.