Enjoy
-Vincent
On Nov 13, 2010, at 8:54 PM, mwallace(a)modusoperandi.com wrote:
Thanks, I'll try this when I get a chance.
BTW, my component file is .xml not .txt (the extension). Is this the way it should be?
-Mark
-----Original Message-----
From: "Vincent Massol"<vincent(a)massol.net>
Sent: Saturday, November 13, 2010 3:05am
To: "XWiki Developers"<devs(a)xwiki.org>
Subject: Re: [xwiki-devs] maven error when trying to write my own component
On Nov 13, 2010, at 8:23 AM, Caleb James DeLisle wrote:
Sorry for the trouble, the archetype in that
tutorial does not work anymore.
See warning:
``The tutorial below is slightly outdated since some changes have been brought to the
Component
Module since it was written. See the Reference document on XWiki Components for fresh
information.
This tutorial needs to be rewritten and duplicate with the Reference document
removed.''
What I do to write a component is copy a small component like xwiki-captcha
and edit the .pom file to suite my needs.
I'll try to find time to update the page.
However it's quite simple:
- create an interface and annotate it with @ComponentRole
- create an implementation and annotate it with @Component
- annotate fields that need to be injected with @Requirement
- add the full package of the implementation in META-INF/components.txt
- drop your jar in WEB-INF/lib or drop your classes in WEB-INF/classes
These steps are described in
http://code.xwiki.org/xwiki/bin/view/Modules/ComponentModule#HUsingAnnotati…
Thanks
-Vincent
> Caleb
>
>
> On 11/12/2010 04:32 PM, Mark Wallace wrote:
>> Hi all,
>>
>> It's my first time trying to develop my own component per this page:
>>
http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents
>>
>> I ran the maven create component steps as follows:
>>
>> C:\dev\xwiki\xwiki-enterprise-2.5-rc-1> mvn install:install-file
>> -Dfile="C:/Downloads/xwiki-archetype-component-1.0-SNAPSHOT.jar"
>> -DartifactId=xwiki-archetype-component
>> -DgroupId=com.xpn.xwiki.platform.tools -Dversion=1.0-SNAPSHOT
>> -Dpackaging=jar
>> . . .
>> C:\dev\xwiki\xwiki-enterprise-2.5-rc-1>mvn archetype:generate
>> -DarchetypeGroupId=com.xpn.xwiki.platform.tools
>> -DarchetypeArtifactId=xwiki-archetype-component
>> -DarchetypeVersion=1.0-SNAPSHOT
>> -DgroupId=com.modusoperandi.xwiki.extentions
>> -DartifactId=xwiki-marktest -Dpackage=com.modusoperandi.xwiki.ext
>> -Dversion=0.1 -Dpackaging=jar
>> . . .
>>
>>
>> Now I have an xwiki-marktest project.
>>
>> Had to comment out the "1.8-SNAPSHOT" property value, making my pom.xml
look like this:
>>
>>
>> C:\dev\xwiki\xwiki-enterprise-2.5-rc-1\xwiki-marktest> type pom.xml
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!--
>> *
>> * See the NOTICE file distributed with this work for additional
>> . . .
>> *
>> --><project
xmlns="http://maven.apache.org/POM/4.0.0"
>>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>
xsi:schemaLocation="http://maven.apache.org/POM/4.0M/4.0.
>> 0
http://maven.apache.org/maven-v4_0_0.xsd">
>> <modelVersion>4.0.0</modelVersion>
>> <parent>
>> <artifactId>xwiki-enterprise-parent</artifactId>
>> <groupId>com.xpn.xwiki.products</groupId>
>> <version>2.5-rc-1</version>
>> </parent>
>> <groupId>com.modusoperandi.xwiki.extentions</groupId>
>> <artifactId>xwiki-marktest</artifactId>
>> <version>0.1</version>
>> <properties>
>> <!-- TODO: remove this if you inherit a project that has the core
>> version set
>> <platform.core.version>1.8-SNAPSHOT</platform.core.version>
>> -->
>> </properties>
>> <dependencies>
>> <dependency>
>> <groupId>org.xwiki.platform</groupId>
>> <artifactId>xwiki-core-component</artifactId>
>> <version>${platform.core.version}</version>
>> </dependency>
>> <dependency>
>> <groupId>junit</groupId>
>> <artifactId>junit</artifactId>
>> <version>3.8.1</version>
>> <scope>test</scope>
>> </dependency>
>> <!-- Add here all your other dependencies -->
>> </dependencies>
>> </project>
>>
>>
>> But when I try to compile I get the "Failure to find..." error shown
below.
>>
>> C:\dev\xwiki\xwiki-enterprise-2.5-rc-1\xwiki-marktest>mvn compile
>> [INFO] Scanning for projects...
>> [INFO]
>> [INFO]
>> ------------------------------------------------------------------------
>> [INFO] Building xwiki-marktest 0.1
>> [INFO]
>> ------------------------------------------------------------------------
>> [INFO]
>> ------------------------------------------------------------------------
>> [INFO] BUILD FAILURE
>> [INFO]
>> ------------------------------------------------------------------------
>> [INFO] Total time: 0.188s
>> [INFO] Finished at: Fri Nov 12 16:24:05 EST 2010
>> [INFO] Final Memory: 2M/254M
>> [INFO]
>> ------------------------------------------------------------------------
>> [ERROR] Failed to execute goal on project xwiki-marktest: Could not
>> resolve dependencies for project
>> com.modusoperandi.xwiki.extentions:xwiki-marktest:jar:0.1:
>> Failure to find org.xwiki.platform:xwiki-core-component:jar:2.5-rc-1
>> in
http://maven.xwiki.org/externals was cached in the local
>> repository, resolution will not
>> be reattempted until the update interval of xwiki-externals has
>> elapsed or updates are forced -> [Help 1]
>> [ERROR]
>> [ERROR] To see the full stack trace of the errors, re-run Maven with
>> the -e switch.
>> [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 read the following articles:
>> [ERROR] [Help 1]
>>
http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionExcept…
>> C:\dev\xwiki\xwiki-enterprise-2.5-rc-1\xwiki-marktest>
>>
>> What do I do now?? Any help would be greatly appreciated.
>>
>> -Mark
_______________________________________________
devs mailing list
devs(a)xwiki.org