1) In web.xml, enable basic authentication
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>default</realm-name>
</login-config>
2) In jboss-web.xml, set security domain
<jboss-web>
<security-domain>java:/jaas/Sample</security-domain>
<context-root>testProject</context-root>
</jboss-web>
3) In login-config.xml file, add entry for "securoty domain" id mentioned in step2.
<application-policy name = "Sample">
<authentication>
<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required"/>
</authentication>
</application>
4) In users.properties file, add username & password entries.
Users entered in this file only can access the resources.
******************************************************************************
Miscellaneous :-
1) For enabling directory listing, don't put any entry for "welcome file list" in web.xml. Also don't put any html file in ROOT directory of war file.
In jboss4.2.3, in server >> default >> deploy >> jboss-web.deployer >> conf >> web.xml, make listing "true" for DefaultServlet InitParameter.
Sunday, April 18, 2010
Thursday, April 1, 2010
MAVEN
Maven is a project Management tool which handles
Dependency Management,
Executing PlugIn Goals,
Defining Project Object Model,
Project life cycle.
Maven can Build, run reports, generate site.
Maven Default Project Structure
${basedir}/src/main/java -- Java Source Directory
${basedir}/src/main/webapp -- Web(JSP, JS, Images, CSS) Directory
${basedir}/src/main/resource -- Resources (properties file etc)
${basedir}/src/test -- test classes
${basedir}/target/classes -- Compiled source output Directory
Maven delegates responsibilities to PlugIns.
e.g.
mvn install uses Maven PlugIn for creating New project.
SureFire plugin is for JUnit test execution.
Maven Important Commands
mvn clean -- Clean Project Workspace
mvn validate -- Validates POM file
mvn test -- Execute Test Cases
mvn package -- Compile & Package artifacts
mvn install -- Deploy artifacts in maven local repository
mvn deploy -- Installs artifact in maven remote repository
mvn site -- Creates site based on contents from /src/site folder
mvn:exec:java -Dexec.mainClass=org.sample.payment.forex -Dexec.args="INR"
mvn help:describe -Dplugin=surefire -- Display help for given plugin
mvn:help effective-pom -- Effective POM for given project
mvn archetype:create -DgroupId=com.sample.payment -DartifactId=forex -DpackageName=com.sample.payment -Dversion=1.0 -- Create New project with default folder structure
Artifacts are stored in repositories in following naming convention
/<groupId>/<artifactId>/<version>/<artifactId>-<version>.<packaging>
Project Versions naming are as follows <major>.<minor>.<incremental>-<qualifier>
If a project contains multiple projects then move common dependencies
to Parent project. So version change for dependencies will be at one
place only. Also group PlugInDependencies in parent project.
Every Maven project includes super-pom.xml file which has common maven tasks
like clean, package, text, install etc
Maven Best Practices
1) Group dependencies :- Create Parent project for big project containing many modules.
& Centralize dependencies in Parent project.
2) "env" variables are accessible in Maven.
e.g:- For Linux, ${JAVA_HOME} will return java home from "env".
3) Project variables can be accessed in including subprojects by using suffix
project for the property
e.g.:- ${project.groupId}
4) settings variable exposes Maven settings information.
Dependency Type
1)Compile :- Default setting. Package specified Jars in final artifacts.
2)Provided :- Dependency jars provided by container like servlet.jar, jta.jar.
3)Test :- Dependency jars used for only testing.
4)Runtime :-
5)System
Build Profiles:- Profiles allow to customize build for particular environments.
e.g. Production, Staging, Development, Testing
mvn clean install -Pproduction
Assembly plugin
Assembly plugin helps in creating custom archievies for projects.
Predefined assembly descrriptors
bin :- It packages LICENSE, README, NOTICE files.
jar-with-dependencies :- It packages jar with unpacked contents of runtime dependencies.It adds Main-Class entry in Manifest.mf file.
project :- It packages project directory structure as it exists in file system.
src :- It packages project directory structure, LICENSE, READ ME, NOTICE, POM.xml file.
Assembly plugin can be executed by binding it to project life cycle.
Dependency Management,
Executing PlugIn Goals,
Defining Project Object Model,
Project life cycle.
Maven can Build, run reports, generate site.
Maven Default Project Structure
${basedir}/src/main/java -- Java Source Directory
${basedir}/src/main/webapp -- Web(JSP, JS, Images, CSS) Directory
${basedir}/src/main/resource -- Resources (properties file etc)
${basedir}/src/test -- test classes
${basedir}/target/classes -- Compiled source output Directory
Maven delegates responsibilities to PlugIns.
e.g.
mvn install uses Maven PlugIn for creating New project.
SureFire plugin is for JUnit test execution.
Maven Important Commands
mvn clean -- Clean Project Workspace
mvn validate -- Validates POM file
mvn test -- Execute Test Cases
mvn package -- Compile & Package artifacts
mvn install -- Deploy artifacts in maven local repository
mvn deploy -- Installs artifact in maven remote repository
mvn site -- Creates site based on contents from /src/site folder
mvn:exec:java -Dexec.mainClass=org.sample.payment.forex -Dexec.args="INR"
mvn help:describe -Dplugin=surefire -- Display help for given plugin
mvn:help effective-pom -- Effective POM for given project
mvn archetype:create -DgroupId=com.sample.payment -DartifactId=forex -DpackageName=com.sample.payment -Dversion=1.0 -- Create New project with default folder structure
Artifacts are stored in repositories in following naming convention
/<groupId>/<artifactId>/<version>/<artifactId>-<version>.<packaging>
Project Versions naming are as follows <major>.<minor>.<incremental>-<qualifier>
If a project contains multiple projects then move common dependencies
to Parent project. So version change for dependencies will be at one
place only. Also group PlugInDependencies in parent project.
Every Maven project includes super-pom.xml file which has common maven tasks
like clean, package, text, install etc
Maven Best Practices
1) Group dependencies :- Create Parent project for big project containing many modules.
& Centralize dependencies in Parent project.
2) "env" variables are accessible in Maven.
e.g:- For Linux, ${JAVA_HOME} will return java home from "env".
3) Project variables can be accessed in including subprojects by using suffix
project for the property
e.g.:- ${project.groupId}
4) settings variable exposes Maven settings information.
Dependency Type
1)Compile :- Default setting. Package specified Jars in final artifacts.
2)Provided :- Dependency jars provided by container like servlet.jar, jta.jar.
3)Test :- Dependency jars used for only testing.
4)Runtime :-
5)System
Build Profiles:- Profiles allow to customize build for particular environments.
e.g. Production, Staging, Development, Testing
mvn clean install -Pproduction
Assembly plugin
Assembly plugin helps in creating custom archievies for projects.
Predefined assembly descrriptors
bin :- It packages LICENSE, README, NOTICE files.
jar-with-dependencies :- It packages jar with unpacked contents of runtime dependencies.It adds Main-Class entry in Manifest.mf file.
project :- It packages project directory structure as it exists in file system.
src :- It packages project directory structure, LICENSE, READ ME, NOTICE, POM.xml file.
Assembly plugin can be executed by binding it to project life cycle.
Subscribe to:
Comments (Atom)