Error when building new xwiki component

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Error when building new xwiki component

Marine Julian
Hello,

To understand how the creation of xwiki component works, I followed the
tutorial at
http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents and I
previously read the Building XWiki from sources page (
http://dev.xwiki.org/xwiki/bin/view/Community/Building). My goal is to
integrate the HelloWorld component (the tutorial one) in my xwiki instance
and to be able to access it in page by velocity.
Here is what I did :
* install maven 3.0 beta and put the settings.xml files in the .m2
* download the xwiki-archetype-velocity-component-1.0-SNAPSHOT.jar<http://platform.xwiki.org/xwiki/bin/download/DevGuide/WritingComponents/xwiki%2Darchetype%2Dvelocity%2Dcomponent%2D1.0%2DSNAPSHOT.jar>,
install it and generate the xwiki component from it
* in the pom.xml of the component, I replace the
<platform.core.version>1.8-SNAPSHOT</platform.core.version> by
<platform.core.version>2.3-SNAPSHOT</platform.core.version>
Then, I tried to install the component (with mvn install) in order to create
a jar I can put in my WEB-INF/lib directory. But, I had the following error
:

*[INFO] Scanning for projects...*

> *[INFO]*
> *[INFO]
> ------------------------------------------------------------------------*
> *[INFO] Building xwiki-essai-component 1.1-SNAPSHOT*
> *[INFO]
> ------------------------------------------------------------------------*
> *[WARNING] Missing POM for velocity-tools:velocity-tools:jar:1.4*
> *[INFO]
> ------------------------------------------------------------------------*
> *[INFO] BUILD FAILURE*
> *[INFO]
> ------------------------------------------------------------------------*
> *[INFO] Total time: 1.050s*
> *[INFO] Finished at: Tue Jul 06 13:25:45 CEST 2010*
> *[INFO] Final Memory: 2M/4M*
> *[INFO]
> ------------------------------------------------------------------------*
> *[ERROR] Failed to execute goal on project xwiki-essai-component: Missing:
> *
> *----------*
> *1) org.xwiki.platform:xwiki-core-component:jar:2.3-SNAPSHOT*
> *  Try downloading the file manually from the project website.*
> *  Then, install it using the command:*
> *      mvn install:install-file -DgroupId=org.xwiki.platform
> -DartifactId=xwiki-c*
> *ore-component -Dversion=2.3-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
> *
> *  Alternatively, if you host your own repository you can deploy the file
> there:*
> *      mvn deploy:deploy-file -DgroupId=org.xwiki.platform
> -DartifactId=xwiki-core-component -Dversion=2.3-SNAPSHOT -Dpackaging=jar
> -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]*
> *  Path to dependency:*
> *        1) com.xpn.xwiki.products:xwiki-essai-component:pom:1.1-SNAPSHOT*
> *        2) org.xwiki.platform:xwiki-core-component:jar:2.3-SNAPSHOT*
> *----------*
> *1 required artifact is missing.*
> *for artifact:*
> *  com.xpn.xwiki.products:xwiki-essai-component:pom:1.1-SNAPSHOT*
> *from the specified remote repositories:*
> *  xwiki-externals (http://maven.xwiki.org/externals, releases=true,
> snapshots=true),*
> *  xwiki-releases (http://maven.xwiki.org/releases, releases=true,
> snapshots=false),*
> *  xwiki-snapshots (http://maven.xwiki.org/snapshots, releases=false,
> snapshots=true),*
> *  central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
> *
> *-> [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/MultipleArtifactsNotFoundException
> *
>

I'm new in Maven so i don't understand where is the problem. But I
dowloaded, as explained, the file
missing<http://maven.xwiki.org/snapshots/org/xwiki/platform/xwiki-core-component/2.3-SNAPSHOT/xwiki-core-component-2.3-20100702.153251-358.pom>and
install it with :
*mvn install:install-file -DgroupId=org.xwiki.platform
-DartifactId=xwiki-core-component -Dversion=2.3-20100702.153251-358
-Dpackaging=jar -Dfile=C:\Users\fnac\Desktop\May\testMVN\pom.xml*
This time, the build succeeded but I didn't have any jar file. And, when I
tried again "mvn install", I had the same error.
I also tried "mvn -nsu clean install" (I read that somewhere) and it was the
same.

Do I miss something ? Is "mvn install" the good way to have a jar ? (I tried
"mvn package" too)

Marine
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Error when building new xwiki component

Anca Luca
Hi Marine,

On 07/06/2010 02:55 PM, Marine JULIAN wrote:

> Hello,
>
> To understand how the creation of xwiki component works, I followed the
> tutorial at
> http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents and I
> previously read the Building XWiki from sources page (
> http://dev.xwiki.org/xwiki/bin/view/Community/Building). My goal is to
> integrate the HelloWorld component (the tutorial one) in my xwiki instance
> and to be able to access it in page by velocity.
> Here is what I did :
> * install maven 3.0 beta and put the settings.xml files in the .m2
> * download the xwiki-archetype-velocity-component-1.0-SNAPSHOT.jar<http://platform.xwiki.org/xwiki/bin/download/DevGuide/WritingComponents/xwiki%2Darchetype%2Dvelocity%2Dcomponent%2D1.0%2DSNAPSHOT.jar>,
> install it and generate the xwiki component from it
> * in the pom.xml of the component, I replace the
> <platform.core.version>1.8-SNAPSHOT</platform.core.version>  by
> <platform.core.version>2.3-SNAPSHOT</platform.core.version>

Right now this would be 2.4-SNAPSHOT or a 2.3 release (2.3, 2.3.1, 2.3.2).

The -SNAPSHOT versions means the .jar produced by the continuous
integration server, from a snapshot of the sources, which exists and
makes sense for the trunk or "active" branches. It's not the case for
the xwiki 2.3 branch, currently the development is for the 2.4 version
(the trunk) so the "current snapshot" or "nightly build" if the term is
more familiar to you, would be a 2.4-SNAPSHOT. If you want your
component to be used on an xwiki 2.3.x, then you should just put that
version as a dependency, instead of "2.3-SNAPSHOT".

I hope it makes some sense...

However, be warned that the tutorial is a little outdated, you'd need to
figure out some things by yourself.

Happy hacking,
Anca

> Then, I tried to install the component (with mvn install) in order to create
> a jar I can put in my WEB-INF/lib directory. But, I had the following error
> :
>
> *[INFO] Scanning for projects...*
>> *[INFO]*
>> *[INFO]
>> ------------------------------------------------------------------------*
>> *[INFO] Building xwiki-essai-component 1.1-SNAPSHOT*
>> *[INFO]
>> ------------------------------------------------------------------------*
>> *[WARNING] Missing POM for velocity-tools:velocity-tools:jar:1.4*
>> *[INFO]
>> ------------------------------------------------------------------------*
>> *[INFO] BUILD FAILURE*
>> *[INFO]
>> ------------------------------------------------------------------------*
>> *[INFO] Total time: 1.050s*
>> *[INFO] Finished at: Tue Jul 06 13:25:45 CEST 2010*
>> *[INFO] Final Memory: 2M/4M*
>> *[INFO]
>> ------------------------------------------------------------------------*
>> *[ERROR] Failed to execute goal on project xwiki-essai-component: Missing:
>> *
>> *----------*
>> *1) org.xwiki.platform:xwiki-core-component:jar:2.3-SNAPSHOT*
>> *  Try downloading the file manually from the project website.*
>> *  Then, install it using the command:*
>> *      mvn install:install-file -DgroupId=org.xwiki.platform
>> -DartifactId=xwiki-c*
>> *ore-component -Dversion=2.3-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
>> *
>> *  Alternatively, if you host your own repository you can deploy the file
>> there:*
>> *      mvn deploy:deploy-file -DgroupId=org.xwiki.platform
>> -DartifactId=xwiki-core-component -Dversion=2.3-SNAPSHOT -Dpackaging=jar
>> -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]*
>> *  Path to dependency:*
>> *        1) com.xpn.xwiki.products:xwiki-essai-component:pom:1.1-SNAPSHOT*
>> *        2) org.xwiki.platform:xwiki-core-component:jar:2.3-SNAPSHOT*
>> *----------*
>> *1 required artifact is missing.*
>> *for artifact:*
>> *  com.xpn.xwiki.products:xwiki-essai-component:pom:1.1-SNAPSHOT*
>> *from the specified remote repositories:*
>> *  xwiki-externals (http://maven.xwiki.org/externals, releases=true,
>> snapshots=true),*
>> *  xwiki-releases (http://maven.xwiki.org/releases, releases=true,
>> snapshots=false),*
>> *  xwiki-snapshots (http://maven.xwiki.org/snapshots, releases=false,
>> snapshots=true),*
>> *  central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
>> *
>> *->  [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/MultipleArtifactsNotFoundException
>> *
>>
>
> I'm new in Maven so i don't understand where is the problem. But I
> dowloaded, as explained, the file
> missing<http://maven.xwiki.org/snapshots/org/xwiki/platform/xwiki-core-component/2.3-SNAPSHOT/xwiki-core-component-2.3-20100702.153251-358.pom>and
> install it with :
> *mvn install:install-file -DgroupId=org.xwiki.platform
> -DartifactId=xwiki-core-component -Dversion=2.3-20100702.153251-358
> -Dpackaging=jar -Dfile=C:\Users\fnac\Desktop\May\testMVN\pom.xml*
> This time, the build succeeded but I didn't have any jar file. And, when I
> tried again "mvn install", I had the same error.
> I also tried "mvn -nsu clean install" (I read that somewhere) and it was the
> same.
>
> Do I miss something ? Is "mvn install" the good way to have a jar ? (I tried
> "mvn package" too)
>
> Marine
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Error when building new xwiki component

Anca Luca
In reply to this post by Marine Julian
Hi Marine,

On 07/06/2010 02:55 PM, Marine JULIAN wrote:

> Hello,
>
> To understand how the creation of xwiki component works, I followed the
> tutorial at
> http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents and I
> previously read the Building XWiki from sources page (
> http://dev.xwiki.org/xwiki/bin/view/Community/Building). My goal is to
> integrate the HelloWorld component (the tutorial one) in my xwiki instance
> and to be able to access it in page by velocity.
> Here is what I did :
> * install maven 3.0 beta and put the settings.xml files in the .m2
> * download the xwiki-archetype-velocity-component-1.0-SNAPSHOT.jar<http://platform.xwiki.org/xwiki/bin/download/DevGuide/WritingComponents/xwiki%2Darchetype%2Dvelocity%2Dcomponent%2D1.0%2DSNAPSHOT.jar>,
> install it and generate the xwiki component from it
> * in the pom.xml of the component, I replace the
> <platform.core.version>1.8-SNAPSHOT</platform.core.version>  by
> <platform.core.version>2.3-SNAPSHOT</platform.core.version>

Right now this would be 2.4-SNAPSHOT or a 2.3 release (2.3, 2.3.1, 2.3.2).

The -SNAPSHOT versions means the .jar produced by the continuous
integration server, from a snapshot of the sources, which exists and
makes sense for the trunk or "active" branches. It's not the case for
the xwiki 2.3 branch, currently the development is for the 2.4 version
(the trunk) so the "current snapshot" or "nightly build" if the term is
more familiar to you, would be a 2.4-SNAPSHOT. If you want your
component to be used on an xwiki 2.3.x, then you should just put that
version for platform dependency, instead of "2.3-SNAPSHOT".

I hope it makes some sense...

However, be warned that the tutorial is a little outdated, you'd need to
figure out some things by yourself.

Happy hacking,
Anca

> Then, I tried to install the component (with mvn install) in order to create
> a jar I can put in my WEB-INF/lib directory. But, I had the following error
> :
>
> *[INFO] Scanning for projects...*
>> *[INFO]*
>> *[INFO]
>> ------------------------------------------------------------------------*
>> *[INFO] Building xwiki-essai-component 1.1-SNAPSHOT*
>> *[INFO]
>> ------------------------------------------------------------------------*
>> *[WARNING] Missing POM for velocity-tools:velocity-tools:jar:1.4*
>> *[INFO]
>> ------------------------------------------------------------------------*
>> *[INFO] BUILD FAILURE*
>> *[INFO]
>> ------------------------------------------------------------------------*
>> *[INFO] Total time: 1.050s*
>> *[INFO] Finished at: Tue Jul 06 13:25:45 CEST 2010*
>> *[INFO] Final Memory: 2M/4M*
>> *[INFO]
>> ------------------------------------------------------------------------*
>> *[ERROR] Failed to execute goal on project xwiki-essai-component: Missing:
>> *
>> *----------*
>> *1) org.xwiki.platform:xwiki-core-component:jar:2.3-SNAPSHOT*
>> *  Try downloading the file manually from the project website.*
>> *  Then, install it using the command:*
>> *      mvn install:install-file -DgroupId=org.xwiki.platform
>> -DartifactId=xwiki-c*
>> *ore-component -Dversion=2.3-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
>> *
>> *  Alternatively, if you host your own repository you can deploy the file
>> there:*
>> *      mvn deploy:deploy-file -DgroupId=org.xwiki.platform
>> -DartifactId=xwiki-core-component -Dversion=2.3-SNAPSHOT -Dpackaging=jar
>> -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]*
>> *  Path to dependency:*
>> *        1) com.xpn.xwiki.products:xwiki-essai-component:pom:1.1-SNAPSHOT*
>> *        2) org.xwiki.platform:xwiki-core-component:jar:2.3-SNAPSHOT*
>> *----------*
>> *1 required artifact is missing.*
>> *for artifact:*
>> *  com.xpn.xwiki.products:xwiki-essai-component:pom:1.1-SNAPSHOT*
>> *from the specified remote repositories:*
>> *  xwiki-externals (http://maven.xwiki.org/externals, releases=true,
>> snapshots=true),*
>> *  xwiki-releases (http://maven.xwiki.org/releases, releases=true,
>> snapshots=false),*
>> *  xwiki-snapshots (http://maven.xwiki.org/snapshots, releases=false,
>> snapshots=true),*
>> *  central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
>> *
>> *->  [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/MultipleArtifactsNotFoundException
>> *
>>
>
> I'm new in Maven so i don't understand where is the problem. But I
> dowloaded, as explained, the file
> missing<http://maven.xwiki.org/snapshots/org/xwiki/platform/xwiki-core-component/2.3-SNAPSHOT/xwiki-core-component-2.3-20100702.153251-358.pom>and
> install it with :
> *mvn install:install-file -DgroupId=org.xwiki.platform
> -DartifactId=xwiki-core-component -Dversion=2.3-20100702.153251-358
> -Dpackaging=jar -Dfile=C:\Users\fnac\Desktop\May\testMVN\pom.xml*
> This time, the build succeeded but I didn't have any jar file. And, when I
> tried again "mvn install", I had the same error.
> I also tried "mvn -nsu clean install" (I read that somewhere) and it was the
> same.
>
> Do I miss something ? Is "mvn install" the good way to have a jar ? (I tried
> "mvn package" too)
>
> Marine
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Error when building new xwiki component

Marine Julian
Hi Anca,

Anca Luca wrote
Right now this would be 2.4-SNAPSHOT or a 2.3 release (2.3, 2.3.1, 2.3.2).

The -SNAPSHOT versions means the .jar produced by the continuous
integration server, from a snapshot of the sources, which exists and
makes sense for the trunk or "active" branches. It's not the case for
the xwiki 2.3 branch, currently the development is for the 2.4 version
(the trunk) so the "current snapshot" or "nightly build" if the term is
more familiar to you, would be a 2.4-SNAPSHOT. If you want your
component to be used on an xwiki 2.3.x, then you should just put that
version for platform dependency, instead of "2.3-SNAPSHOT".

I hope it makes some sense...

However, be warned that the tutorial is a little outdated, you'd need to
figure out some things by yourself.
Indeed, I didn't grasp the meaning of "SNAPSHOT" and it makes sense now ! Thanks !
Like I use a xwiki 2.3.1, I put the "2.3.1" version for platform dependency. Unfortunately, I always had the same error... I.e :

[ERROR] Failed to execute goal on project xwiki-essai-component: Missing:
----------
1) org.xwiki.platform:xwiki-core-component:jar:2.3.1
  Try downloading the file manually from the project website.
 
  Then, install it using the command:
      mvn install:install-file -DgroupId=org.xwiki.platform -DartifactId=xwiki-core-component -Dversion=2.3.1 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=org.xwiki.platform -DartifactId=xwiki-core-component -Dversion=2.3.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) com.xpn.xwiki.platform:xwiki-essai-component:pom:1.1
        2) org.xwiki.platform:xwiki-core-component:jar:2.3.1

----------
1 required artifact is missing.

for artifact:
  com.xpn.xwiki.platform:xwiki-essai-component:pom:1.1

from the specified remote repositories:
  xwiki-externals (http://maven.xwiki.org/externals, releases=true, snapshots=true),
  xwiki-releases (http://maven.xwiki.org/releases, releases=true, snapshots=false),
  xwiki-snapshots (http://maven.xwiki.org/snapshots, releases=false, snapshots=true),
  central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
-> [Help 1]


Do you think it's due to the fact that the tutorial is outdated ? Because, I didn't do something special : just downloaded the archetype, modified the version for platform dependency in the pom file and tried to install it in order to have a jar...
Reply | Threaded
Open this post in threaded view
|

Re: Error when building new xwiki component

Marius Dumitru Florea
Hi Marine,

On 07/06/2010 04:38 PM, Marine Julian wrote:

>
> Hi Anca,
>
>
> Anca Luca wrote:
>>
>> Right now this would be 2.4-SNAPSHOT or a 2.3 release (2.3, 2.3.1, 2.3.2).
>>
>> The -SNAPSHOT versions means the .jar produced by the continuous
>> integration server, from a snapshot of the sources, which exists and
>> makes sense for the trunk or "active" branches. It's not the case for
>> the xwiki 2.3 branch, currently the development is for the 2.4 version
>> (the trunk) so the "current snapshot" or "nightly build" if the term is
>> more familiar to you, would be a 2.4-SNAPSHOT. If you want your
>> component to be used on an xwiki 2.3.x, then you should just put that
>> version for platform dependency, instead of "2.3-SNAPSHOT".
>>
>> I hope it makes some sense...
>>
>> However, be warned that the tutorial is a little outdated, you'd need to
>> figure out some things by yourself.
>>
>
> Indeed, I didn't grasp the meaning of "SNAPSHOT" and it makes sense now !
> Thanks !
> Like I use a xwiki 2.3.1, I put the "2.3.1" version for platform dependency.
> Unfortunately, I always had the same error... I.e :
>
> [ERROR] Failed to execute goal on project xwiki-essai-component: Missing:
> ----------
> 1) org.xwiki.platform:xwiki-core-component:jar:2.3.1
>    Try downloading the file manually from the project website.
>
>    Then, install it using the command:
>        mvn install:install-file -DgroupId=org.xwiki.platform
> -DartifactId=xwiki-core-component -Dversion=2.3.1 -Dpackaging=jar
> -Dfile=/path/to/file
>
>    Alternatively, if you host your own repository you can deploy the file
> there:
>        mvn deploy:deploy-file -DgroupId=org.xwiki.platform
> -DartifactId=xwiki-core-component -Dversion=2.3.1 -Dpackaging=jar
> -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
>
>    Path to dependency:
>          1) com.xpn.xwiki.platform:xwiki-essai-component:pom:1.1
>          2) org.xwiki.platform:xwiki-core-component:jar:2.3.1
>
> ----------
> 1 required artifact is missing.
>
> for artifact:
>    com.xpn.xwiki.platform:xwiki-essai-component:pom:1.1
>
> from the specified remote repositories:
>    xwiki-externals (http://maven.xwiki.org/externals, releases=true,
> snapshots=true),

>    xwiki-releases (http://maven.xwiki.org/releases, releases=true,
> snapshots=false),

The required dependency should have been found at
http://maven.xwiki.org/releases/org/xwiki/platform/xwiki-core-component/2.3.1/ 
but as you can see there's no jar there. The reason is that the
xwiki-core-component module was split in multiple submodules. You need
to edit you pom and change the dependency from xwiki-core-component to
xwiki-core-component-api like this:

<dependency>
   <groupId>org.xwiki.platform</groupId>
   <artifactId>xwiki-core-component-api</artifactId>
   <version>${pom.version}</version>
</dependency>

Hope this helps,
Marius

>    xwiki-snapshots (http://maven.xwiki.org/snapshots, releases=false,
> snapshots=true),
>    central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
> ->  [Help 1]
>
> Do you think it's due to the fact that the tutorial is outdated ? Because, I
> didn't do something special : just download the archetype, modify the
> version for platform dependency in the pom file and try to install it in
> order to have a jar...
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Error when building new xwiki component

Marine Julian
Hi Marius,
Marius Dumitru Florea wrote
The required dependency should have been found at
http://maven.xwiki.org/releases/org/xwiki/platform/xwiki-core-component/2.3.1/ 
but as you can see there's no jar there. The reason is that the
xwiki-core-component module was split in multiple submodules. You need
to edit you pom and change the dependency from xwiki-core-component to
xwiki-core-component-api like this:

<dependency>
   <groupId>org.xwiki.platform</groupId>
   <artifactId>xwiki-core-component-api</artifactId>
   <version>${pom.version}</version>
</dependency>
You're totally right. In fact, I just replace "xwiki-core-component" by "xwiki-core-component-api" and the build succeeded. So, I finally can have my jar ! Thanks.

Now, i'm facing that my component can't be caledl by groovy or velocity. I hope that you can help me again. My first thought was wondering if the component needs to be declared somewhere, but it seems not.

Neither
{{groovy wiki="false"}}
def greeter = com.xpn.xwiki.web.Utils.getComponent(org.xwiki.essai.component.HelloWorld.class);
println greeter.sayHello();

{{/groovy}}
or
{{velocity}} $greeter.sayHello(); {{/velocity}}
works.

The groovy code throws the following error :
org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Script Macro for content [def greeter = com.xpn.xwiki.web.Utils.getComponent(org.xwiki.essai.component.HelloWorld.class); println greeter.sayHello();]
    at org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.evaluate(AbstractJSR223ScriptMacro.java:201)
    at org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.evaluate(AbstractJSR223ScriptMacro.java:50)
    at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:200)
    at org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.execute(AbstractJSR223ScriptMacro.java:137)
    at org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.execute(AbstractJSR223ScriptMacro.java:50)
    [...]
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: javax.script.ScriptException: javax.script.ScriptException: java.lang.RuntimeException: Failed to load component [org.xwiki.essai.component.HelloWorld] for hint [default]
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:117)
    at org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.eval(AbstractJSR223ScriptMacro.java:260)
    at org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.evaluate(AbstractJSR223ScriptMacro.java:191) ... 79 more
Caused by: javax.script.ScriptException: java.lang.RuntimeException: Failed to load component [org.xwiki.essai.component.HelloWorld] for hint [default]
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317)
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:111)
    ... 81 more
Caused by: java.lang.RuntimeException: Failed to load component [org.xwiki.essai.component.HelloWorld] for hint [default] at com.xpn.xwiki.web.Utils.getComponent(Utils.java:614)
    at com.xpn.xwiki.web.Utils.getComponent(Utils.java:635)
    at com.xpn.xwiki.web.Utils$getComponent.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
    at Script7.run(Script7.groovy:1)
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:314)
    ... 82 more
Caused by: org.xwiki.component.manager.ComponentLookupException: Can't find descriptor for the component [role = [org.xwiki.essai.component.HelloWorld] hint = [default]]
    at org.xwiki.component.embed.EmbeddableComponentManager.initialize(EmbeddableComponentManager.java:356)
    at org.xwiki.component.embed.EmbeddableComponentManager.lookup(EmbeddableComponentManager.java:109)
    at org.xwiki.component.internal.DefaultComponentManager.lookup(DefaultComponentManager.java:85)
    at com.xpn.xwiki.web.Utils.getComponent(Utils.java:612)
    ... 89 more  


What is the descriptor for the component ?
Besides, like I know the tutorial outdated, I tried to modify the code of the component by adding annotations and a components.txt, but the build failed cause the annotations was unknown (at least, they seems to be unknown).

Can anybody give me some ideas that I can use the HelloWorld component through velocity in my xwiki pages ?
Reply | Threaded
Open this post in threaded view
|

Re: Error when building new xwiki component

vmassol
Administrator
Hi Marine,

On Jul 7, 2010, at 11:50 AM, Marine Julian wrote:

>
> Hi Marius,
>
> Marius Dumitru Florea wrote:
>>
>> The required dependency should have been found at
>> http://maven.xwiki.org/releases/org/xwiki/platform/xwiki-core-component/2.3.1/ 
>> but as you can see there's no jar there. The reason is that the
>> xwiki-core-component module was split in multiple submodules. You need
>> to edit you pom and change the dependency from xwiki-core-component to
>> xwiki-core-component-api like this:
>>
>> <dependency>
>>   <groupId>org.xwiki.platform</groupId>
>>   <artifactId>xwiki-core-component-api</artifactId>
>>   <version>${pom.version}</version>
>> </dependency>
>>
>
> You're totally right. In fact, I just replace "xwiki-core-component" by
> "xwiki-core-component-api" and the build succeeded. So, I finally can have
> my jar ! Thanks.
>
> Now, i'm facing that my component can't be caledl by groovy or velocity. I
> hope that you can help me again. My first thought was wondering if the
> component needs to be declared somewhere, but it seems not.

Yes it needs to be declared in a META-INF/components.txt file.
See the doc at
http://code.xwiki.org/xwiki/bin/view/Modules/ComponentModule

Thanks
-Vincent

>
> Neither
> {{groovy wiki="false"}}
> def greeter =
> com.xpn.xwiki.web.Utils.getComponent(org.xwiki.essai.component.HelloWorld.class);
> println greeter.sayHello();
> {{/groovy}}
> or
> {{velocity}} $greeter.sayHello(); {{/velocity}}
> works.
>
> The groovy code throws the following error :
> org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Script
> Macro for content [def greeter =
> com.xpn.xwiki.web.Utils.getComponent(org.xwiki.essai.component.HelloWorld.class);
> println greeter.sayHello();]
>    at
> org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.evaluate(AbstractJSR223ScriptMacro.java:201)
>    at
> org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.evaluate(AbstractJSR223ScriptMacro.java:50)
>    at
> org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:200)
>    at
> org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.execute(AbstractJSR223ScriptMacro.java:137)
>    at
> org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.execute(AbstractJSR223ScriptMacro.java:50)
>    [...]
>    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
>    at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
>    at
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
> Caused by: javax.script.ScriptException: javax.script.ScriptException:
> java.lang.RuntimeException: Failed to load component
> [org.xwiki.essai.component.HelloWorld] for hint [default]
>    at
> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:117)
>    at
> org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.eval(AbstractJSR223ScriptMacro.java:260)
>    at
> org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.evaluate(AbstractJSR223ScriptMacro.java:191)
> ... 79 more
> Caused by: javax.script.ScriptException: java.lang.RuntimeException: Failed
> to load component [org.xwiki.essai.component.HelloWorld] for hint [default]
>    at
> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317)
>    at
> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:111)
>    ... 81 more
> Caused by: java.lang.RuntimeException: Failed to load component
> [org.xwiki.essai.component.HelloWorld] for hint [default] at
> com.xpn.xwiki.web.Utils.getComponent(Utils.java:614)
>    at com.xpn.xwiki.web.Utils.getComponent(Utils.java:635)
>    at com.xpn.xwiki.web.Utils$getComponent.call(Unknown Source)
>    at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
>    at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
>    at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
>    at Script7.run(Script7.groovy:1)
>    at
> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:314)
>    ... 82 more
> Caused by: org.xwiki.component.manager.ComponentLookupException: Can't find
> descriptor for the component [role = [org.xwiki.essai.component.HelloWorld]
> hint = [default]]
>    at
> org.xwiki.component.embed.EmbeddableComponentManager.initialize(EmbeddableComponentManager.java:356)
>    at
> org.xwiki.component.embed.EmbeddableComponentManager.lookup(EmbeddableComponentManager.java:109)
>    at
> org.xwiki.component.internal.DefaultComponentManager.lookup(DefaultComponentManager.java:85)
>    at com.xpn.xwiki.web.Utils.getComponent(Utils.java:612)
>    ... 89 more  
>
> What is the descriptor for the component ?
> Besides, like I know the tutorial outdated, I tried to modify the code of
> the component by adding annotations and a components.txt, but the build
> failed cause the annotations was unknown (at least, they seems to be
> unknown).
>
> Can anybody give me some ideas that I can use the HelloWorld component
> through velocity in my xwiki pages ?
> --
> View this message in context: http://xwiki.475771.n2.nabble.com/Error-when-building-new-xwiki-component-tp5259941p5264413.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Error when building new xwiki component

Marine Julian
Hi Vincent,

vmassol wrote
Yes it needs to be declared in a META-INF/components.txt file.
See the doc at
http://code.xwiki.org/xwiki/bin/view/Modules/ComponentModule
After some tries, I finally succeed to use the HelloWorld component with groovy and velocity in my wiki !! Like you said, I declared it in a META-INF/components.txt. I also added all the annotations as described in http://code.xwiki.org/xwiki/bin/view/Modules/ComponentModule (without being stupid and forgetting the "import org.xwiki.component.annotation.*;" !!).

So, thank you Anca, Marius and Vincent for your help.