Hi Mark,
On Nov 16, 2010, at 8:22 PM, Mark Wallace wrote:
OK, I've had good success with the new tutorial I
have now written an Event Listener to listen to DocumentSaveEvent, DocumentUpdateEvent,
and DocumentDeleteEvent.
My OnEvent method now has a bit more code in it, which compiles fine for me in Eclipse,
but not in Maven. I am still new to maven (mvn) and I'm guessing I am missing a
dependency for some of the new classes I added to my sample listener.
My pom.xml looks like this:
From the error below you need the model module:
groupId = org.xwiki.platform
artifact id= xwiki-core-model
Seems you also need
groupId = com.xpn.xwiki.platform
artifactid = xwiki-core
-Vincent
C:\dev\xwiki\xwiki-enterprise-2.5-rc-1\marktest>type pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<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</groupId>
<artifactId>marktest</artifactId>
<version>1.0-SNAPSHOT</version>
<name>XWiki Macro - Hello World Component</name>
<description>XWiki Macro - Hello World Component</description>
<properties>
<platform.core.version>2.5</platform.core.version>
</properties>
<dependencies>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-core-component-default</artifactId>
<version>${platform.core.version}</version>
</dependency>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-core-script</artifactId>
<version>${platform.core.version}</version>
</dependency>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-core-shared-tests</artifactId>
<version>${platform.core.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
and when I run it I get this:
C:\dev\xwiki\xwiki-enterprise-2.5-rc-1\marktest>mvn install
[INFO] Scanning for projects...
[INFO]
[INFO]
------------------------------------------------------------------------
[INFO] Building XWiki Macro - Hello World Component 1.0-SNAPSHOT
[INFO]
------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0-beta-1:enforce (default) @
marktest ---
[WARNING] This rule is not compatible with the current version of
Maven. The rule is not able to perform any checks.
[INFO]
[INFO] --- maven-remote-resources-plugin:1.1:process
(xwiki-license-resources) @ marktest ---
[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources
(default-resources) @ marktest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @
marktest ---
[INFO] Compiling 1 source file to
C:\dev\xwiki\xwiki-enterprise-2.5-rc-1\marktest\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR]
\dev\xwiki\xwiki-enterprise-2.5-rc-1\marktest\src\main\java\com\modusoperandi\xwiki\internal\MyListenerExtension.java:[8,32]
package org.xwiki.model.ref
erence does not exist
[ERROR]
\dev\xwiki\xwiki-enterprise-2.5-rc-1\marktest\src\main\java\com\modusoperandi\xwiki\internal\MyListenerExtension.java:[15,24]
package com.xpn.xwiki.doc
does not exist
[ERROR]
\dev\xwiki\xwiki-enterprise-2.5-rc-1\marktest\src\main\java\com\modusoperandi\xwiki\internal\MyListenerExtension.java:[16,28]
package com.xpn.xwiki.obje
cts does not exist
[ERROR]
\dev\xwiki\xwiki-enterprise-2.5-rc-1\marktest\src\main\java\com\modusoperandi\xwiki\internal\MyListenerExtension.java:[69,2]
cannot find symbol
symbol : class XWikiDocument
location: class com.modusoperandi.xwiki.internal.MyListenerExtension
[ERROR]
\dev\xwiki\xwiki-enterprise-2.5-rc-1\marktest\src\main\java\com\modusoperandi\xwiki\internal\MyListenerExtension.java:[69,24]
cannot find symbol
symbol : class XWikiDocument
location: class com.modusoperandi.xwiki.internal.MyListenerExtension
[ERROR]
\dev\xwiki\xwiki-enterprise-2.5-rc-1\marktest\src\main\java\com\modusoperandi\xwiki\internal\MyListenerExtension.java:[74,2]
cannot find symbol
symbol : class DocumentReference
location: class com.modusoperandi.xwiki.internal.MyListenerExtension
[ERROR]
\dev\xwiki\xwiki-enterprise-2.5-rc-1\marktest\src\main\java\com\modusoperandi\xwiki\internal\MyListenerExtension.java:[74,35]
cannot find symbol
symbol : class DocumentReference
location: class com.modusoperandi.xwiki.internal.MyListenerExtension
[ERROR]
\dev\xwiki\xwiki-enterprise-2.5-rc-1\marktest\src\main\java\com\modusoperandi\xwiki\internal\MyListenerExtension.java:[76,7]
cannot find symbol
symbol : class BaseObject
location: class com.modusoperandi.xwiki.internal.MyListenerExtension
[ERROR]
\dev\xwiki\xwiki-enterprise-2.5-rc-1\marktest\src\main\java\com\modusoperandi\xwiki\internal\MyListenerExtension.java:[77,16]
cannot find symbol
symbol : class BaseObject
location: class com.modusoperandi.xwiki.internal.MyListenerExtension
[ERROR]
\dev\xwiki\xwiki-enterprise-2.5-rc-1\marktest\src\main\java\com\modusoperandi\xwiki\internal\MyListenerExtension.java:[78,3]
cannot find symbol
symbol : class BaseObject
location: class com.modusoperandi.xwiki.internal.MyListenerExtension
[ERROR]
\dev\xwiki\xwiki-enterprise-2.5-rc-1\marktest\src\main\java\com\modusoperandi\xwiki\internal\MyListenerExtension.java:[78,28]
cannot find symbol
symbol : class BaseObject
location: class com.modusoperandi.xwiki.internal.MyListenerExtension
[INFO] 11 errors
[INFO] -------------------------------------------------------------
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
. . .
What do I do to fix this?
Thanks,
Mark Wallace
Principal Engineer, Semantic Applications
Modus Operandi, Melbourne, FL, USA
On 11/15/2010 4:21 AM, Vincent Massol wrote:
Hi Mark,
I've taken the time to rewrite the tutorial:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents
Enjoy
-Vincent
On Nov 13, 2010, at 8:54 PM, mwallace(a)modusoperandi.com wrote:
[snip...]
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs