For investors
股价:
5.36 美元 %For investors
股价:
5.36 美元 %认真做教育 专心促就业
昆明达内培训的老师这一期讲的教程需要Java1.5+,并且我们用Maven生成项目,当然Maven不是必须的,你也可以通过导入Shiro jar包的方式、或使用Ant、Ivy,喜欢哪种就用哪种。
开始之前,确定你的Maven版本为2.2.1+(如果你用的是Maven的话),用mvn --version确定Maven的版本。
现在,我们将正式开始。首先新建一个文件夹,比如说shiro-tutorial,然后将下面的Maven pom.xml文件放到该文件夹下。
pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project xmlns="#/POM/4.0.0"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:schemaLocation="#/POM/4.0.0 #/maven-v4_0_0.xsd">
5
6 <modelVersion>4.0.0</modelVersion>
7 <groupId>org.apache.shiro.tutorials</groupId>
8 <artifactId>shiro-tutorial</artifactId>
9 <version>1.0.0-SNAPSHOT</version>
10 <name>First Apache Shiro Application</name>
11 <packaging>jar</packaging>
12
13 <properties>
14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15 </properties>
16
17 <build>
18 <plugins>
19 <plugin>
20 <groupId>org.apache.maven.plugins</groupId>
21 <artifactId>maven-compiler-plugin</artifactId>
22 <version>2.0.2</version>
23 <configuration>
24 <source>1.5</source>
25 <target>1.5</target>
26 <encoding>${project.build.sourceEncoding}</encoding>
27 </configuration>
28 </plugin>
29
30 <!-- This plugin is only to test run our little application. It is not
31 needed in most Shiro-enabled applications: -->
32 <plugin>
33 <groupId>org.codehaus.mojo</groupId>
34 <artifactId>exec-maven-plugin</artifactId>
35 <version>1.1</version>
36 <executions>
37 <execution>
38 <goals>
39 <goal>java</goal>
40 </goals>
41 </execution>
42 </executions>
43 <configuration>
44 <classpathScope>test</classpathScope>
45 <mainClass>Tutorial</mainClass>
46 </configuration>
47 </plugin>
48 </plugins>
49 </build>
50
51 <dependencies>
52 <dependency>
53 <groupId>org.apache.shiro</groupId>
54 <artifactId>shiro-core</artifactId>
55 <version>1.1.0</version>
56 </dependency>
57 <!-- Shiro uses SLF4J for logging. We'll use the 'simple' binding
58 in this example app. See # for more info. -->
59 <dependency>
60 <groupId>org.slf4j</groupId>
61 <artifactId>slf4j-simple</artifactId>
62 <version>1.6.1</version>
63 <scope>test</scope>
64 </dependency>
65 </dependencies>
66
67 </project>
下一期昆明达内培训的老师讲The Tutorial class。