You are on page 1of 13

AppFuse V1.

2014-10-29
AppFuse

http://appfuse.org/display/APF/AppFuse+QuickStart

AppFuse

1.

1.1

JDK
Oracle JDKAppFuse JDK

JDK 6+ JDK 7+ JDK 7+

JDK

7+

http://www.oracle.com/technetwork/java/javase/overview/index.html
JDK 7+ JAVA_HOME JDK PATH

1.2

Maven
Maven apache AppFuse Maven

Maven 3.1.0+ Maven 2 Maven


3 Maven 3.1.0+
AppFuse Maven 3 AppFuse

Maven 3.1.0 AppFuse


Maven

http://maven.apache.org/download.cgi
Maven 3.1.0+ MAVEN_HOME Maven
PATH

1.3

MySQL
MySQL MySQL 5.5+

MySQL

http://dev.mysql.com/downloads/mysql/5.0.html#downloads
MySQL 5.5+ MySQL MySQL
PATH

cp user4cp
//cp
create database cp;
//user4cp/user4cp
insert
into
mysql.user(Host,User,Password)
values("localhost","user4cp",password("user4cp"));
flush privileges;
//
grant all privileges on cp.* to user4cp@localhost identified by 'user4cp';
flush privileges;

1.4

SMTP
AppFuse SMTP

SMTP
Apache James SMTP
http://james.apache.org/

1.5

JDKMavenMySQL

HOME AppFuse HOME


HOME=C:\MyEclipseWorkspaces
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_71
MAVEN=C:\app\apache-maven-3.1.1\bin
MAVEN_HOME=C:\app\apache-maven-3.1.1
MYSQL_HOME=C:\xampp\mysql
Path=C:\app\zhangmengzhi\product\11.2.0\dbhome_1\bin;C:\Windows\system32;C:\Wind
ows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Prog
ram Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL
SDK\2.0\bin\x64;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.7.0
_71\bin;C:\app\apache-maven-3.1.1\bin;C:\xampp\mysql\bin;C:\app\zhangmengzhi\pro
duct\11.2.0\dbhome_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL
SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program
Files\TortoiseSVN\bin

2. AppFuse

2.1

AppFuse
http://appfuse.org/display/APF/AppFuse+QuickStart AppFuse

Maven

AppFuse Spring MVC Modular Maven

mvn
archetype:generate
-B
-DarchetypeGroupId=org.appfuse.archetypes
-DarchetypeArtifactId=appfuse-modular-spring-archetype
-DarchetypeVersion=3.0.0
-DgroupId=org.zhangmz
-DartifactId=commonproject
-DarchetypeRepository=https://oss.sonatype.org/content/repositories/appfuse

2.2

AppFuse
HOME

C:\Users\zhangmengzhi>cd %HOME%

2.1

AppFuse Maven

AppFuse Maven BUILD SUCCESS


AppFuse
C:\MyEclipseWorkspaces>
mvn
archetype:generate
-B
-DarchetypeGroupId=org.appfuse.archetypes
-DarchetypeArtifactId=appfuse-modular-spring-archetype
-DarchetypeVersion=3.0.0
-DgroupId=org.zhangmz
-DartifactId=commonproject
-DarchetypeRepository=https://oss.sonatype.org/content/repositories/appfuse
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------------------------------------------------------[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------

[INFO]
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>
>
[INFO]
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom <<
<
[INFO]
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom -[INFO] Generating project in Batch mode
[INFO] Archetype defined by properties
[INFO] --------------------------------------------------------------------------[INFO] Using following parameters for creating project from Archetype: appfuse-m
odular-spring-archetype:3.0.0
[INFO] --------------------------------------------------------------------------[INFO] Parameter: groupId, Value: org.zhangmz
[INFO] Parameter: artifactId, Value: commonproject
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: org.zhangmz
[INFO] Parameter: packageInPathFormat, Value: org/zhangmz
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: org.zhangmz
[INFO] Parameter: groupId, Value: org.zhangmz
[INFO] Parameter: artifactId, Value: commonproject
[INFO] Parent element not overwritten in C:\MyEclipseWorkspaces\commonproject\co
re\pom.xml
[INFO] Parent element not overwritten in C:\MyEclipseWorkspaces\commonproject\we
b\pom.xml
[INFO] project created from Archetype in dir: C:\MyEclipseWorkspaces\commonproje
ct
[INFO] -----------------------------------------------------------------------[INFO] BUILD SUCCESS
[INFO] -----------------------------------------------------------------------[INFO] Total time: 1.338s
[INFO] Finished at: Wed Oct 29 14:12:53 CST 2014
[INFO] Final Memory: 12M/243M
[INFO] -----------------------------------------------------------------------C:\MyEclipseWorkspaces>

HOME commonproject commonproject


pom.xml MySQL

AppFuse
AppFuse

3.

3.1

AppFuse
commonproject AppFuse

mvn appfuse:full-source mvn jar


C:\Users\zhangmengzhi>cd %HOME%/commonproject
C:\MyEclipseWorkspaces\commonproject>mvn appfuse:full-source
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
org.zhangmz:commonproject-web:war:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.exclusions.exclusion.artifactId' for org.spri
ngmodules:spring-modules-validation:jar with value '*' does not match a valid id
pattern. @ line 214, column 33
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten t
he stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support buildin
g such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------

[INFO] Reactor Build Order:


[INFO]
[INFO] AppFuse Modular Application
[INFO] AppFuse Modular Application - Core
[INFO] AppFuse Modular Application - Web (Spring MVC)
[INFO]
[INFO] -----------------------------------------------------------------------[INFO] Building AppFuse Modular Application 1.0-SNAPSHOT
[INFO] -----------------------------------------------------------------------[INFO]
[INFO] --- appfuse-maven-plugin:3.0.0:full-source (default-cli) @ commonproject
--[INFO] [AppFuse] Source successfully exported, modifying pom.xml...
[INFO] [AppFuse] Adding dependencies from root module...
[INFO] [AppFuse] Updated dependencies in pom.xml...
[INFO]
[INFO] -----------------------------------------------------------------------[INFO] Building AppFuse Modular Application - Core 1.0-SNAPSHOT
[INFO] -----------------------------------------------------------------------[INFO]
[INFO] --- appfuse-maven-plugin:3.0.0:full-source (default-cli) @ commonprojectcore --[INFO] [AppFuse] Installing source from data-common module...
[INFO] [AppFuse] Installing source from hibernate module...
[INFO] [AppFuse] Installing source from service module...
[ERROR] Failed to delete '/C:\MyEclipseWorkspaces\commonproject\core\src\test\re
sources\hibernate.properties', please delete manually.
[INFO] [AppFuse] Source successfully exported, modifying pom.xml...
[INFO] [AppFuse] Adding dependencies from root module...
[INFO] [AppFuse] Adding dependencies from data module...
[INFO] [AppFuse] Adding dependencies from data-common module...
[INFO] [AppFuse] Adding dependencies from hibernate module...
[INFO] [AppFuse] Adding dependencies from service module...
[WARNING] The POM for org.aspectj:aspectjweaver:jar:1.8.0.M1 is missing, no depe
ndency information available
[INFO] [AppFuse] Updated dependencies in pom.xml...
[INFO] [AppFuse] Renaming packages to 'org.zhangmz'...
[info] [AppFuse] Refactored all 'org.appfuse' packages and paths to 'org.zhangmz
'.
[INFO]
[INFO] -----------------------------------------------------------------------[INFO] Building AppFuse Modular Application - Web (Spring MVC) 1.0-SNAPSHOT
[INFO] -----------------------------------------------------------------------[INFO]

[INFO] --- appfuse-maven-plugin:3.0.0:full-source (default-cli) @ commonprojectweb --[INFO] [AppFuse] Source successfully exported, modifying pom.xml...
[INFO] [AppFuse] Adding dependencies from root module...
[INFO] [AppFuse] Adding dependencies from web module...
[INFO] [AppFuse] Adding dependencies from web-common module...
[INFO] [AppFuse] Adding dependencies from spring module...
[INFO] [AppFuse] Updated dependencies in pom.xml...
[INFO] [AppFuse] Renaming packages to 'org.zhangmz'...
[info] [AppFuse] Refactored all 'org.appfuse' packages and paths to 'org.zhangmz
'.
[INFO] -----------------------------------------------------------------------[INFO] Reactor Summary:
[INFO]
[INFO] AppFuse Modular Application ....................... SUCCESS [3.755s]
[INFO] AppFuse Modular Application - Core ................ SUCCESS [22.323s]
[INFO] AppFuse Modular Application - Web (Spring MVC) .... SUCCESS [5.413s]
[INFO] -----------------------------------------------------------------------[INFO] BUILD SUCCESS
[INFO] -----------------------------------------------------------------------[INFO] Total time: 31.678s
[INFO] Finished at: Wed Oct 29 14:18:00 CST 2014
[INFO] Final Memory: 13M/243M
[INFO] -----------------------------------------------------------------------C:\MyEclipseWorkspaces\commonproject>mvn
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.zhangmz:commonproject:1.0-SNAPSHOT (C:\MyEclipseWorksp
aces\commonproject\pom.xml) has 10 errors
[ERROR]
'dependencies.dependency.version' for commons-lang:commons-lang:jar
must be a valid version but is '${commons.lang.version}'. @ line 144, column 22
[ERROR]
'dependencies.dependency.version' for log4j:log4j:jar must be a vali
d version but is '${log4j.version}'. @ line 155, column 22
[ERROR]
'dependencies.dependency.version' for org.aspectj:aspectjweaver:jar
must be a valid version but is '${aspectj.version}'. @ line 178, column 22
[ERROR]
'dependencies.dependency.version' for org.aspectj:aspectjrt:jar must
be a valid version but is '${aspectj.version}'. @ line 183, column 22
[ERROR]
'dependencies.dependency.version' for org.slf4j:slf4j-api:jar must b
e a valid version but is '${slf4j.version}'. @ line 194, column 22
[ERROR]
'dependencies.dependency.version' for org.slf4j:jcl-over-slf4j:jar m
ust be a valid version but is '${slf4j.version}'. @ line 199, column 22
[ERROR]
'dependencies.dependency.version' for org.slf4j:slf4j-log4j12:jar mu
st be a valid version but is '${slf4j.version}'. @ line 204, column 22

[ERROR]
'dependencies.dependency.version' for org.springframework.security:s
pring-security-core:jar must be a valid version but is '${spring.security.versio
n}'. @ line 214, column 22
[ERROR]
'dependencies.dependency.version' for org.springframework.security:s
pring-security-config:jar must be a valid version but is '${spring.security.vers
ion}'. @ line 219, column 22
[ERROR]
'dependencies.dependency.version' for org.springframework.security:s
pring-security-ldap:jar must be a valid version but is '${spring.security.versio
n}'. @ line 224, column 22
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildin
gException
C:\MyEclipseWorkspaces\commonproject>

jar
AppFuse Maven
Maven Maven
AppFuse
jar Maven
repository Maven repository
AppFuse pom.xml Maven repository
AppFuse
Maven repository
%MAVEN_HOME%/conf/settings.xml
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->


${user.home}/.m2/repository

Maven

repository

Window7

C:\Users\zhangmengzhi\.m2\repository/

AppFuse AppFuse mvn appfuse:full-source


Maven 10

3.2

mvn jetty:run-war modular

web mvn jetty:run-war[INFO] Started Jetty Server


Jetty
http://localhost:8080

admin/admin user/userAdmin

3.3

eclipse
commonproject eclipse mvn

eclipse:eclipsemodular mvn install eclipse:eclipse


mvn jarBUILD SUCCESS eclipse

C:\MyEclipseWorkspaces\commonproject> mvn install eclipse:eclipse

3.4

eclipse
eclipse MyEclipse 2013 AppFuse Eclipse

Maven

3.1

AppFuse mvn jar

Maven repository ${user.home}/.m2/repositoryWindow7


C:\Users\zhangmengzhi\.m2\repository
M2_REPO C:\Users\zhangmengzhi\.m2\repository
eclipse Window -> Preferences -> Java -> Build Path -> Classpath
Variables

->

New

Name

C:\Users\zhangmengzhi\.m2\repository

M2_REPO

Path

3.2

AppFuse

commonproject mvn appfuse:copy-templates


src/test/resources/appfuse .ftl

<amp.genericCore>false</amp.genericCore>
<amp.fullSource>true</amp.fullSource>

genericCore
true DAO Manager
fullSource true genericCore false
fullSource true