Ant task list in appfuse

Source: Internet
Author: User
Tags file url gz file checkstyle


Ant task list in appfuse

UseAppfuse Development and ApplicationProgramYou often need to use the ant task defined in the Development Kit. Here is a detailed description of the ant task:

Task Name

Description

Bin

Create war packages, JDBC drivers, and XML files

Checkstyle

CheckCodeCompliance with code specifications

Clean Clear various products
Compile Compile-web alias
Compile-Dao Compile Dao Module
Compile-Service Compile the service module
Compile-Web Compile the web module
Copy-Resources Copy the. properties and. xml files from the original program directory.
Copy-web-Files Copy static files
DB-create Create a database of the $ {database. Type} type
DB-drop Delete database tables
DB-export Export data in the current database
DB-Load Load the sample data to the database
DB-prepare Create a database table
Deploy Deploy the war package to the Application Server Directory.
Deploy-test-Reports Publish the JUnit Test Report to the server.
Deploy-war Publish/'$ {webapp. name}. War/' to the local Tomcat server.
Deploy-Web Only publish the Web classes file to the servlet container
Bytes  
Dist A compressed tar.gz file, including all paths and files for distribution.
Docs Run javadoc, todo, checkstyle, and PMD tasks.
FTP Upload the classification file to the specified server through ftps
Gen-tests-Dao Generate Test classes for Dao Module
Gen-tests-Service Generate Test Programs for Modules
Gen-tests-Web Generate a test program for the web module
Hibernatedoclet Generate a hibernate ing File
Init Add a custom task
Install Tomcat installation Application
Install-ibatis Install ibatis
Install-springmvc Install spring/'s MVC and delete struts
Install-webwork Install webwork and delete struts
Java2html Create an HTML page to view code online
Javadoc Generate javadoc API documentation
Jsp-2 Convert JSP 1.2 tags (I. e. jstl) to JSP 2.0 standard
List List all Tomcat applications
New Create a project named after a user
Package-Dao Into a separate jar package
Package-Web Apply a war package
Ping-Tomcat Pings Tomcat determines that Tomcat is still running
PMD Locate useless imports statements, useless variables, and so on.
Prepare Create target directory
Refresh Clear the original program and release it again
Reload Reload the application in Tomcat
Remove Remove an application from Tomcat
Setup Create a database, set the Tomcat environment, and release the unpacking Application
Setup-DB Creating a database and filling in data will be called by many other tasks
Setup-Tomcat Copy JDBC driver and context. XML to the Tomcat directory.
Stage-Web Call all other tasks to collect static Resources
Start Start the Tomcat Application
Start. Tomcat Start tomcat in the current Console window
Stop Stop a tomcat Application
Test-all Run a pojo. All tests include Dao, service, web, and JSP.
Test-all-running Run all daos, services, controllers and JSPs tests.
Test-canoo Run canoo webtests to test JSP programs in Tomcat
Test-Dao Test Dao Module
Test-JSP Run canoo webtests using cargo
Test-Reports Generate Test report
Test-Service Test Service Module
Test-Web Test the web module
Todo Create a todo task report in the code
Undeploy Delete or reverse install a published war File
War Package-web alias
Webdoclet Web development Description
Wiki Download files from wiki to generate documents
-- Author: bibiye
-- Release Date: 20:03:44

--

Appfuse practice (1) -- configure and install

I use webwork + spring + hibernate. For more information, see tutorial.

I. Prepare the system environment
Download from http://java.sun.com, I use 1.4.2 _ 05.
Download Tomcat from latest Tomcat release. The current version is 5.0.28. It is best not to use the Le version. Otherwise, you need to add the jar packages of DBCP and javamail.
Download the latest appfuse version. I use appfuse 1.6.
Download MySQL.

Ant, XDoclet, spring, Hibernate (or ibatis), JUnit, cactus, strutstestcase, canoo/'s webtest, Struts menu, display tag library, Oscache, jstl and Struts (or spring MVC) components.

2. install and configure appfuse
Download appfuse and decompress
MySQL server needs to be started
Utf8 is the default character set used to create your own application database, which is critical because appfuse supports multiple languages or the program cannot run normally. Therefore, the default Character Set of the MySQL server should also be utf8. I don't know how to change MySQL to the utf8 character set. I started it by using the name line parameter:
Mysqld -- default-character-set = utf8

Now you can use ant to create your own application:
Ant New-dapp. Name = MyApp-DDB. Name = mydb

If you need to change the database, you can modify the parameters in the build. properties file:
# Database. Jar =$ {PostgreSQL. Jar}
# Database. type = PostgreSQL
# Database. Name = MyApp
# Database. Host = localhost
# Database URL for creating other databases (doesn/'t work with pgsql)
# Database. admin. url = JDBC :$ {database. Type}: // $ {database. Host}/template1
# Database. admin. Username = s
# Database. admin. Password = s

# Hibernate. dialect = net. SF. hibernate. dialect. postgresqldialect
# Database. driver_class = org. PostgreSQL. Driver
# Database. url = JDBC :$ {database. Type}: // $ {database. Host}/$ {database. name}

Create a database and publish applications on Tomcat

Run
Ant setup

If an error occurs, the database mydb cannot be created automatically. The error message is as follows:
Build failed: D: // myfile // MyApp // build. xml: 830: org. dbunit. dataset. nosuchtableexception: app_user

Check the execution process and put the automatically executed SQL statement for creating app_user in MySQL control center for execution.
Create Table app_user (
Username varchar (20) not null,
Version integer not null,
Password varchar (1, 255 ),
First_name varchar (50 ),
Last_name varchar (50 ),
Address varchar (150 ),
City varchar (50 ),
Province varchar (100 ),
Country varchar (100 ),
Postal_code varchar (15 ),
Email varchar (255) not null unique,
Phone_number varchar (255 ),
Webwebsite varchar (255 ),
Password_hint varchar (255 ),
Primary Key (username)
);
Execution failed. error message:
[Root @ localhost: 3306] Error 1071: specified key was too long. Max key length is 500
Modified as follows,
Change email varchar (255) not null unique
Email varchar (100) not null unique,

After testing, an error occurs when the length exceeds 166 (inclusive!
I don't know why it is caused by the utf8 character set. Is a utf8 character considered to occupy three bytes (500/3 <167 )??
That is to say, the length of the field declared as not null unique cannot exceed 166.

Because the SQL statement is automatically created based on the pojo Tag:

Find the source program of org. appfuse. model. User.

Modify
@ Hibernate. Column name = "email" not-null = "true" unique = "true"

Changed:
@ Hibernate. Column name = "email" not-null = "true" length = "166" unique = "true"

Run
Ant setup-DB

Successful! OK!

Start Tomcat 5.0.25
Run
Ant setup

Error

Build failed: D: // edu // build. xml: 33: Please copy JUnit. jar into C: // ANT/lib

Complete copying

Successful! Excellent!
Open the Firefox browser and run it:

Input: http: // 127.0.0.1: 8080/MyApp

No response ?? What's going on ??

Start Tomcat under the command line to see if there are any error messages:

Unregistering logger Catalina: TYPE = logger, Path =/MyApp, host = localhost

Open C: // Tomcat // conf // Catalina // localhost // myaqpp. xml

Modify: comment out the logger Information
<! -- Logger classname = "org. Apache. Catalina. Logger. filelogger" prefix = "myapp_log." suffix = ". txt" timestamp = "true"/-->

Restart Tomcat

Still incorrect

Tomcat 5.0.5.28
The error message has changed.
Application not started ??

Run the task

Ant install

Failed! The error message is as follows:

Build failed: D: // myfile // MyApp // build. XML: 1221: Java. io. ioexception: server returned HTTP response code: 401 for URL: http: // localhost: 8080/manager/deploy? Path = % 2 fmyapp

Enter http: // localhost: 8080/manager/deploy in the browser? Path = % 2 fmyapp

?? In the displayed window, enter the user name and password.
View MyApp // tomcat. properties. The administrator password is admin and Admin.

Modify Tomcat // conf // tomcat-users.xml add administrator Admin

Add two roles

<Role rolename = "admin"/>
<Role rolename = "manager"/>

Add Admin user
<User Username = "admin" Password = "admin" roles = "role1, tomcat, admin, Manager"/>

Delete the MyApp directory under Tomcat and the MyApp. xml file under conf // Catalina // localhost, and restart tomcat.

Run

Ant install

Success !!

However, Tomcat reports the following error:
2004-11-14 19:59:49 org. Apache. Catalina. Core. standardhostdeployer install
Information: Processing context Configuration File URL File:/C:/tomcat/CONF/Catalina/localhost/MyApp. xml
2004-11-14 19:59:49 org. Apache. Catalina. Core. standardhostdeployer install
Information: Installing web application from URL jar: file:/C:/tomcat/webapps/MyApp. War!
/
2004-11-14 20:00:04 org. Apache. Catalina. Core. standardcontext listenerstart
Severe: skipped installing application listeners due to previous error (s)
2004-11-14 20:00:04 org. Apache. Catalina. Core. standardcontext start
Severe: Error listenerstart
2004-11-14 20:00:04 org. Apache. Catalina. Core. standardcontext start
Severe: context startup failed due to previous errors
2004-11-14 20:00:04 org. Apache. Catalina. Logger. loggerbase stop
Information: unregistering logger Catalina: TYPE = logger, Path =/MyApp, host = localhost

Why ??

Incorrect tomcat version ??

Run the struts installer.

Run ant install-webwork again

Build failed: D: // myfile // MyApp // build. xml: 1391: basedir D: // myfile // MyApp // extras // webwork does not exist

Hmm ~~

Change the extras // viewgen directory name to webwork

Run ant install-webwork again

Run ant install again

Open Firefox and enter http: // 127.0.0.1: 8080/MyApp. Successful!

Enter the user name mraible
Password Tomcat

OK !! Enter the main interface (the interface is not uploaded, sorry ^_^)

 

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.