Skip to content

Instantly share code, notes, and snippets.

@endymuhardin
Created January 25, 2011 08:16
Show Gist options
  • Save endymuhardin/794650 to your computer and use it in GitHub Desktop.
Save endymuhardin/794650 to your computer and use it in GitHub Desktop.
shell command untuk membuat struktur folder
springVersion = "3.0.5.RELEASE"
springSecurityVersion = "3.0.5.RELEASE"
slf4jVersion = "1.6.1"
logbackVersion = "0.9.27"
jodaTimeVersion = "1.6.2"
sourceCompatibility = 1.6
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
configurations {
all*.exclude group: "commons-logging", module: "commons-logging"
}
repositories {
mavenCentral()
}
dependencies {
compile "org.slf4j:jcl-over-slf4j:$slf4jVersion",
"org.slf4j:jul-to-slf4j:$slf4jVersion"
runtime "joda-time:joda-time:$jodaTimeVersion"
runtime "ch.qos.logback:logback-classic:$logbackVersion"
testCompile 'junit:junit:4.7'
}
group = 'com.artivisi.contoh'
version = '1.0-SNAPSHOT'
sourceCompatibility = 1.6
task wrapper(type: Wrapper) {
gradleVersion = '0.9.1'
jarFile = 'wrapper/wrapper.jar'
}
}
project('com.artivisi.contoh.domain') {
dependencies {
compile "org.hibernate:hibernate-entitymanager:3.4.0.GA"
compile "org.springframework:spring-tx:$springVersion",
"org.springframework:spring-orm:$springVersion",
"org.springframework:spring-jdbc:$springVersion"
}
}
project('com.artivisi.contoh.service.impl') {
dependencies {
compile project(':com.artivisi.contoh.domain')
compile "org.hibernate:hibernate-entitymanager:3.4.0.GA"
compile "org.springframework:spring-tx:$springVersion",
"org.springframework:spring-orm:$springVersion",
"org.springframework:spring-jdbc:$springVersion"
}
}
project('com.artivisi.contoh.ui.springmvc') {
dependencies {
compile project(':com.artivisi.contoh.service.impl')
compile "org.springframework:spring-webmvc:$springVersion",
"org.springframework:spring-aop:$springVersion"
compile "org.springframework.security:spring-security-web:$springSecurityVersion",
"org.springframework.security:spring-security-config:$springSecurityVersion"
compile "javax.validation:validation-api:1.0.0.GA",
"org.hibernate:hibernate-validator:4.0.2.GA"
}
}
project('com.artivisi.contoh.ui.web') {
apply plugin: 'war'
apply plugin: 'jetty'
dependencies {
compile project(':com.artivisi.contoh.ui.springmvc')
runtime project(':com.artivisi.contoh.config')
runtime "javax.servlet:jstl:1.1.2",
"taglibs:standard:1.1.2",
"opensymphony:sitemesh:2.4.2"
providedCompile "javax.servlet:servlet-api:2.5"
}
}
for d in */; do cd "$d"; gradle eclipse; cd ..; done
mkdir -p project-contoh/com.artivisi.contoh.{config,domain,service.impl,ui.springmvc,ui.web}/src/{main,test}/{java,resources}
mkdir -p project-contoh/com.artivisi.contoh.ui.web/src/main/webapp/WEB-INF
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.artivisi.contoh</groupId>
<artifactId>com.artivisi.contoh.parent</artifactId>
<version>1.0</version>
</parent>
<artifactId>com.artivisi.contoh.config</artifactId>
<packaging>jar</packaging>
<name>Konfigurasi Project Contoh</name>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.artivisi.contoh</groupId>
<artifactId>com.artivisi.contoh.parent</artifactId>
<version>1.0</version>
</parent>
<artifactId>com.artivisi.contoh.domain</artifactId>
<packaging>jar</packaging>
<name>Domain Model dan Service API Project Contoh</name>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.artivisi.contoh</groupId>
<artifactId>com.artivisi.contoh.parent</artifactId>
<version>1.0</version>
</parent>
<artifactId>com.artivisi.contoh.service.impl</artifactId>
<packaging>jar</packaging>
<name>Implementasi Service Project Contoh</name>
<dependencies>
<dependency>
<groupId>com.artivisi.contoh</groupId>
<artifactId>com.artivisi.contoh.domain</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.artivisi.contoh</groupId>
<artifactId>com.artivisi.contoh.parent</artifactId>
<version>1.0</version>
</parent>
<artifactId>com.artivisi.contoh.ui.springmvc</artifactId>
<packaging>jar</packaging>
<name>Spring MVC Project Contoh</name>
<dependencies>
<dependency>
<groupId>com.artivisi.contoh</groupId>
<artifactId>com.artivisi.contoh.domain</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.artivisi.contoh</groupId>
<artifactId>com.artivisi.contoh.parent</artifactId>
<version>1.0</version>
</parent>
<artifactId>com.artivisi.contoh.ui.web</artifactId>
<packaging>war</packaging>
<name>Aplikasi Web Project Contoh</name>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.artivisi.contoh</groupId>
<artifactId>com.artivisi.contoh.ui.springmvc</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.artivisi.contoh</groupId>
<artifactId>com.artivisi.contoh.service.impl</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.artivisi.contoh</groupId>
<artifactId>com.artivisi.contoh.config</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.artivisi.contoh</groupId>
<artifactId>com.artivisi.contoh.parent</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<name>Project Contoh</name>
<description>Project Contoh</description>
<modules>
<module>com.artivisi.contoh.config</module>
<module>com.artivisi.contoh.domain</module>
<module>com.artivisi.contoh.service.impl</module>
<module>com.artivisi.contoh.ui.springmvc</module>
<module>com.artivisi.contoh.ui.web</module>
</modules>
<!-- Shared version number properties -->
<properties>
<org.springframework.version>3.0.5.RELEASE</org.springframework.version>
<org.slf4j.version>1.6.1</org.slf4j.version>
<ch.qos.logback.version>0.9.27</ch.qos.logback.version>
<joda-time.version>1.6.2</joda-time.version>
</properties>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<!-- SLF4J + Logback -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${org.slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${ch.qos.logback.version}</version>
<scope>runtime</scope>
</dependency>
<!-- Joda Time -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda-time.version}</version>
</dependency>
<!--
Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA, and iBatis.
(depends on spring-core, spring-beans, spring-context, spring-tx)
Define this if you need ORM (org.springframework.orm.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Spring MVC for Servlet Environments (depends on spring-core, spring-beans, spring-context, spring-web)
Define this if you use Spring MVC with a Servlet Container such as Apache Tomcat (org.springframework.web.servlet.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--
Spring Security
-->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
</dependencies>
</project>
include "com.artivisi.contoh.config"
include "com.artivisi.contoh.domain"
include "com.artivisi.contoh.service.impl"
include "com.artivisi.contoh.ui.springmvc"
include "com.artivisi.contoh.ui.web"
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- Scans the classpath of this application for @Components to deploy as beans -->
<context:component-scan base-package="com.artivisi.contoh.ui.web" />
<!-- Configures the @Controller programming model -->
<mvc:annotation-driven />
<!-- mengganti default servletnya Tomcat dan Jetty -->
<!-- ini diperlukan kalau kita mapping DispatcherServlet ke / -->
<!-- sehingga tetap bisa mengakses folder selain WEB-INF, misalnya img, css, js -->
<mvc:default-servlet-handler/>
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources/ directory -->
<mvc:resources mapping="/resources/**" location="/resources/" />
<!-- Application Message Bundle -->
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="/WEB-INF/messages/messages" />
<property name="cacheSeconds" value="0" />
</bean>
<!-- Resolves view names to protected .jsp resources within the /WEB-INF/views directory -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/templates/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
<!-- Forwards requests to the "/" resource to the "hello" view -->
<mvc:view-controller path="/" view-name="hello"/>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- Reads request input using UTF-8 encoding -->
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Handles all requests into the application -->
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/springmvc-context.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment