Jahia DX > Module creation...

0 (0 Good)
0 (0 Bad)

Module creation issue using maven archetype

by  elie »  2011/06/07 17:54

Hi,

 

We got feedbacks from people who are using our Jahia SDK and try to build their own module.

If you run following command :

mvn archetype:generate -DarchetypeCatalog=http://maven.jahia.org/maven2"

maven creates a directory tree for a new module.

Then, if you try to compile this new module, mvn generates the following error because a properties file in the resource directory is missing.

[INFO] Copying webapp webResources[C:\Documents and Settings\jahia\Desktop\youtube\target/native2ascii] to[C:\Documents

and Settings\jahia\Desktop\youtube\target\youtube-1.0-SNAPSHOT]

[INFO] ------------------------------------------------------------------------

[ERROR] FATAL ERROR

[INFO] ------------------------------------------------------------------------

[INFO] basedir C:\Documents and Settings\jahia\Desktop\youtube\target\native2ascii does not exist

[INFO] ------------------------------------------------------------------------

[INFO] Trace

java.lang.IllegalStateException: basedir C:\Documents and Settings\jahia\Desktop\youtube\target\native2ascii does not exist

        at org.codehaus.plexus.util.DirectoryScanner.scan(DirectoryScanner.java:550)

        at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.getFilesToCopy(WarProjectPackagingTask.java:366)

        at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.copyResources(WarProjectPackagingTask.java:310)

        at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.handleWebResources(WarProjectPackagingTask.java:131)

        at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.performPackaging(WarProjectPackagingTask.java:87)

        at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:462)

        at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:394)

        at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:195)

        at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:157)

        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)

        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)

        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)

        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)

        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)

        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)

        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)

        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)

        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)

        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)

        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:597)

        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)

        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)

        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 7 seconds

[INFO] Finished at: Wed Dec 22 09:49:01 EST 2010

[INFO] Final Memory: 42M/101M

[INFO] ------------------------------------------------------------------------

The .properties file is no longer automatically created - mainly because there is not yet a way to automatically modify the filename with archetypes (see:http://jira.codehaus.org/browse/ARCHETYPE-191).

The above exception is caused by the latest modification in the jahia-mopdule-archetype, which sets in the pom.xml that properies from <directory>${project.build.directory}/native2ascii</directory> should be copied. But if there are no properties, this file is not existing, which unfortuntaly leads to the above exception. The issue is also reported here: http://jira.codehaus.org/browse/MWAR-244

 

A workaround exits as written in the jahia-module-archetype\src\site\apt\index.apt where we documented the following: 

 

As the resources are in the module itself, you have to create them manually after the project creation. To do so, create a file with this rule : get the module name and remove spaces (e.g. MyModule) and use the extension .properties for the default bundle. 

If you have resource bundle in different languages then you need to add _<language-code> between the module name without spaces and the extension (e.g. MyModule_en.properties, MyModule_fr.properties).

Following these instructions, you should have the following structure:

+--

  my-module

  `-- src

      `-- main

          `-- webapp

              `-- resources

                  |-- MyModule.properties

                  |-- MyModule_fr.properties

                  `-- MyModule_de.properties

+--

 

The Jahia Team is currently working on this issue to ease the module creation.

 

Thanks again for your precious feedbacks !

 

The Jahia Team

misterElieAuvray

Elie Auvray (elie)

Number of messages  7
Registration date
Contact
Share
Feedback

Get in touch

Whether you are a current user or if you are just evaluating Jahia, we are here to help.

Contact us

Share this page