Change comment:
Fix tutorial now that our archetype is on maven central
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. ThomasMortagne1 +XWiki.VincentMassol - Content
-
... ... @@ -18,18 +18,28 @@ 18 18 19 19 == Creating a XWiki component using Maven == 20 20 21 -As you've read in the [[XWiki Component Reference>>extensions:Extension.Component Module]] writing a component is a three-streps process (component interface, component implementation, registration of component). To make it easier for you to get started, we have created a maven archetype to help create a simple component module with a single command.21 +As you've read in the [[XWiki Component Reference>>extensions:Extension.Component Module]] writing a component is a three-streps process (component interface, component implementation, registration of component). 22 22 23 - After you've[[installedMavenand addedXWikirepositories inyourprofile>>dev:Community.Building#HInstallingMaven]],opena shellpromptand type:23 +To make it easier for you to get started, we have created a [[Maven Archetype>>http://maven.apache.org/plugins/maven-archetype-plugin/]] to help create a simple component module with a single command. 24 24 25 +After you've [[installed Maven>>http://maven.apache.org]], open a shell prompt an type: 25 25 {{code language="none"}} 26 -mvn archetype:generate -DarchetypeCatalog=https://raw.github.com/xwiki/xwiki-platform/master/xwiki-platform-tools/xwiki-platform-tool-archetypes/xwiki-platform-tool-archetype-component/archetype-catalog.xml27 +mvn archetype:generate 27 27 {{/code}} 28 28 30 +This will list all archetypes available on Maven Central. If instead you wish to directly use the XWiki Component Archetype, you can directly type (update the version to use the version you wish to use): 31 + 32 +{{code language="none"}} 33 +mvn archetype:generate \ 34 + -DarchetypeArtifactId=xwiki-commons-component-archetype \ 35 + -DarchetypeGroupId=org.xwiki.commons \ 36 + -DarchetypeVersion=3.3 37 +{{/code}} 38 + 29 29 Then follow the instructions. For example: 30 30 31 31 {{code language="none"}} 32 -vmassol@t arget$ mvn archetype:generate-DarchetypeCatalog=https://raw.github.com/xwiki/xwiki-platform/master/xwiki-platform-tools/xwiki-platform-tool-archetypes/xwiki-platform-tool-archetype-component/archetype-catalog.xml42 +vmassol@tmp $ mvn archetype:generate 33 33 [INFO] Scanning for projects... 34 34 [INFO] 35 35 [INFO] ------------------------------------------------------------------------ ... ... @@ -36,20 +36,23 @@ 36 36 [INFO] Building Maven Stub Project (No POM) 1 37 37 [INFO] ------------------------------------------------------------------------ 38 38 [INFO] 39 -[INFO] >>> maven-archetype-plugin:2. 1:generate (default-cli) @ standalone-pom >>>49 +[INFO] >>> maven-archetype-plugin:2.0:generate (default-cli) @ standalone-pom >>> 40 40 [INFO] 41 -[INFO] <<< maven-archetype-plugin:2. 1:generate (default-cli) @ standalone-pom <<<51 +[INFO] <<< maven-archetype-plugin:2.0:generate (default-cli) @ standalone-pom <<< 42 42 [INFO] 43 -[INFO] --- maven-archetype-plugin:2. 1:generate (default-cli) @ standalone-pom ---53 +[INFO] --- maven-archetype-plugin:2.0:generate (default-cli) @ standalone-pom --- 44 44 [INFO] Generating project in Interactive mode 45 45 [INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0) 46 46 Choose archetype: 47 -1: https://raw.github.com/xwiki/xwiki-platform/master/xwiki-platform-tools/xwiki-platform-tool-archetypes/xwiki-platform-tool-archetype-component/archetype-catalog.xml -> org.xwiki.platform:xwiki-platform-tool-archetype-component (Make it easy to create a maven project for creating a XWiki Component.) 48 -Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1 49 -Downloading: http://maven.xwiki.org/snapshots/org/xwiki/platform/tools/xwiki-archetype-component/1.0-SNAPSHOT/maven-metadata.xml 50 -Downloaded: http://maven.xwiki.org/snapshots/org/xwiki/platform/tools/xwiki-archetype-component/1.0-SNAPSHOT/maven-metadata.xml (383 B at 3.4 KB/sec) 51 -Downloading: http://maven.xwiki.org/snapshots/org/xwiki/platform/tools/xwiki-archetype-component/1.0-SNAPSHOT/maven-metadata.xml 52 -Downloaded: http://maven.xwiki.org/snapshots/org/xwiki/platform/tools/xwiki-archetype-component/1.0-SNAPSHOT/maven-metadata.xml (383 B at 4.9 KB/sec) 57 +... 58 +493: remote -> org.xwiki.commons:xwiki-commons-component-archetype (Make it easy to create a maven project for creating XWiki Components.) 59 +... 60 +Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 152: 493 61 +Choose org.xwiki.commons:xwiki-commons-component-archetype version: 62 +1: 3.3-milestone-1 63 +2: 3.3-milestone-2 64 +3: 3.3-SNAPSHOT 65 +Choose a number: 3: 53 53 Define value for property 'groupId': : com.acme 54 54 Define value for property 'artifactId': : example 55 55 Define value for property 'version': 1.0-SNAPSHOT: : ... ... @@ -61,24 +61,25 @@ 61 61 package: com.acme 62 62 Y: : Y 63 63 [INFO] ---------------------------------------------------------------------------- 64 -[INFO] Using following parameters for creating project from Old (1.x)Archetype: xwiki-archetype-component:1.0-SNAPSHOT77 +[INFO] Using following parameters for creating project from Archetype: xwiki-commons-component-archetype:3.3-SNAPSHOT 65 65 [INFO] ---------------------------------------------------------------------------- 66 66 [INFO] Parameter: groupId, Value: com.acme 67 -[INFO] Parameter: packageName, Value: com.acme 68 -[INFO] Parameter: package, Value: com.acme 69 69 [INFO] Parameter: artifactId, Value: example 70 -[INFO] Parameter: basedir, Value: /Users/vmassol/dev/xwiki/trunks-clean4/platform/tools/xwiki-archetypes/target 71 71 [INFO] Parameter: version, Value: 1.0-SNAPSHOT 72 -[INFO] ********************* End of debug info from resources from generated POM *********************** 73 -[INFO] project created from Old (1.x) Archetype in dir: /Users/vmassol/dev/xwiki/trunks-clean4/platform/tools/xwiki-archetypes/target/example 82 +[INFO] Parameter: package, Value: com.acme 83 +[INFO] Parameter: packageInPathFormat, Value: com/acme 84 +[INFO] Parameter: package, Value: com.acme 85 +[INFO] Parameter: version, Value: 1.0-SNAPSHOT 86 +[INFO] Parameter: groupId, Value: com.acme 87 +[INFO] Parameter: artifactId, Value: example 88 +[INFO] project created from Archetype in dir: /private/tmp/example 74 74 [INFO] ------------------------------------------------------------------------ 75 75 [INFO] BUILD SUCCESS 76 76 [INFO] ------------------------------------------------------------------------ 77 -[INFO] Total time: 12.868s78 -[INFO] Finished at: SunNov1418:27:52CET 201079 -[INFO] Final Memory: 9M/81M92 +[INFO] Total time: 7:58.355s 93 +[INFO] Finished at: Tue Dec 06 17:18:00 CET 2011 94 +[INFO] Final Memory: 7M/81M 80 80 [INFO] ------------------------------------------------------------------------ 81 -vmassol@target $ 82 82 {{/code}} 83 83 84 84 Then go in the created directory (##example## in our example above) and run ##mvn install## to build your component.