现在Eclipse已经有AEM的插件了,可以直接在Eclipse里面New project创建AEM项目。 但是,还是把命令行创建AEM项目的方法po上来,以供参考,欢迎大神指正。
1. 用以下内容替换Maven的settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- 修改为你本地的Maven仓库路径 -->
<localRepository>C:/Repositories/Maven</localRepository>
<profiles>
<profile>
<id>adobe-public</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<releaseRepository-Id>adobe-public-releases</releaseRepository-Id>
<releaseRepository-Name>Adobe Public Releases</releaseRepository-Name>
<releaseRepository-URL>http://repo.adobe.com/nexus/content/groups/public</releaseRepository-URL>
</properties>
<repositories>
<repository>
<id>adobe-public-releases</id>
<name>Adobe Public Repository</name>
<url>http://repo.adobe.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>adobe-public-releases</id>
<name>Adobe Public Repository</name>
<url>http://repo.adobe.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>adobe-public</activeProfile>
</activeProfiles>
</settings>
2. 在cmd出入以下命令
mvn archetype:generate -DarchetypeRepository=https://repo.adobe.com/nexus/content/groups/public/ -DarchetypeGroupId=com.day.jcr.vault -DarchetypeArtifactId=multimodule-content-package-archetype -DarchetypeVersion=1.0.2 -DgroupId=my-group-id -DartifactId=myproject -Dversion=1.0-SNAPSHOT -Dpackage=com.mycompany.myproject -DappsFolderName=myproject -DartifactName="My Project" -DcqVersion="5.6.1" -DpackageGroup="My Company"
这里是创建一个项目名称为myproject的项目。
执行命令如果报错:the desired archetype does not exist (multimodule-content-package-archetype),需要将https://repo.adobe.com/nexus/content/groups/public/com/day/jcr/vault/multimodule-content-package-archetype/1.0.2/目录下的multimodule-content-package-archetype-1.0.2.jar下载并放到配置的本地仓库对应的目录下。
3. 重新执行2的命令
控制台提示输入(Y::), 输入y,回车
Build Success。 项目创建成功。
另附在Eclipse中创建AEM项目的教程,原贴:http://www.adobeaemclub.com/how-to-set-up-aem-projects-using-eclipse-plugin/