update sample after package refactor

This commit is contained in:
Jarred Li
2012-07-16 10:27:36 +08:00
parent f939d3c9b4
commit e038798a29
7 changed files with 39 additions and 143 deletions

View File

@@ -43,18 +43,15 @@ dependencies {
current version is 1.0.0.BUILD-SNAPSHOT
# Building
Spring Shell is built with Gradle. To build Spring Shell, run
Spring Shell currently uses Maven as its build system. The build been done using version 3.0.3 (r1075438; 2011-02-28 12:31:09-0500) and the plan is to switch to gradle.
To build Spring Shell, run
mvn package
./gradlew
# Running Example
cd samples/helloworld
mvn package
java -jar target/helloworld-1.0.0.BUILD.SNAPSHOT.jar
../../gradlew
java -jar build/libs/helloworld-1.0.0.BUILD-SNAPSHOT.jar
# Contributing

112
pom.xml
View File

@@ -1,112 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Spring Shell</name>
<url>http://www.springframework.org</url>
<description>
<![CDATA[
This project is a minimal jar utility with Spring configuration.
]]>
</description>
<properties>
<jar.mainclass>org.springframework.shell.Bootstrap</jar.mainclass>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
<spring.framework.version>3.1.1.RELEASE</spring.framework.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.framework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<!-- CGLIB needed for use of @Configuration class based extension points -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.3</version>
</dependency>
<!-- External modules -->
<dependency>
<groupId>net.sourceforge.jline</groupId>
<artifactId>jline</artifactId>
<version>1.0.S2-B</version>
</dependency>
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<version>${project.version}</version>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<!-- jline 1.0.S2-B is here http://shrub.appspot.com/spring-roo-repository.springsource.org/release/net/sourceforge/jline/jline/1.0.S2-B/ -->
<repositories>
<repository>
<id>spring-roo-repository</id>
<name>Spring Roo Maven Repository</name>
<url>http://spring-roo-repository.springsource.org/release</url>
</repository>
</repositories>
</project>

View File

@@ -1,23 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>helloworld</name>
<comment></comment>
<projects>
</projects>
<comment>Spring Shell Example</comment>
<projects/>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
<arguments/>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
<linkedResources/>
</projectDescription>

View File

@@ -16,6 +16,23 @@ dependencies {
compile "org.springframework.shell:spring-shell:$springShellVersion"
testCompile "junit:junit:$junitVersion"
}
mainClassName = "org.springframework.shell.Bootstrap"
defaultTasks 'clean', 'build'
task copyDependency(type: Copy) {
into "$buildDir/libs/dependency"
from configurations.runtime
}
project.ext.springShellJar = configurations.runtime.find { file -> file.name.contains("spring-shell")}
//println("spring shell name is:" + project.ext.springShellJar.name)
project.ext.manifestClasspath = "dependency/" + springShellJar.name + " "
project.ext.manifestClasspath = project.ext.manifestClasspath + configurations.runtime.collect{ File file -> "dependency/"+file.name}.join(' ')
jar {
baseName "helloworld"
manifest {
attributes 'Main-Class' : 'org.springframework.shell.Bootstrap', "Class-Path" : project.ext.manifestClasspath
}
}
defaultTasks 'clean', 'build', 'copyDependency'

View File

@@ -11,9 +11,9 @@ Maven:
Gradle
1.Build and install the project
$>../../gradlew installApp
$>../../gradlew
2.run spring shell
$>.\build\install\helloworld\bin\helloworld.bat
$>java -jar build/libs/helloworld-1.0.0.BUILD-SNAPSHOT.jar

View File

@@ -1,9 +1,10 @@
package org.springframework.shell.samples.helloworld.commands;
import org.springframework.roo.shell.CliAvailabilityIndicator;
import org.springframework.roo.shell.CliCommand;
import org.springframework.roo.shell.CliOption;
import org.springframework.roo.shell.CommandMarker;
import org.springframework.shell.core.CommandMarker;
import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
import org.springframework.shell.core.annotation.CliCommand;
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;
@Component

View File

@@ -17,9 +17,9 @@ package org.springframework.shell.samples.helloworld.commands;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.roo.shell.CliCommand;
import org.springframework.roo.shell.CommandMarker;
import org.springframework.shell.support.util.StringUtils;
import org.springframework.shell.core.CommandMarker;
import org.springframework.shell.core.annotation.CliCommand;
import org.springframework.shell.plugin.support.DefaultBannerProvider;
import org.springframework.stereotype.Component;