I'm hoping to create a simple Xwiki macro to allow users an easy way
to create local file:// links to internal network shares through the
WYSIWYG macros feature. This is also an excuse for me to try to get
m2eclipse to work for building Xwiki as well. However, so far the
plugin doesn't seem to be working right.
I'm generally following the guide here:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/RenderingMacroTutorial#HC…
I first attempted at using Eclipse's m2eclipse plugin to create a new
maven project, but had some troubles with this. I first added a maven
archetypes catalog through the Window->Preferences->Maven->Archetypes
menu. I added a remote catalog using the url
"http://svn.xwiki.org/svnroot/xwiki/platform/xwiki-tools/trunk/xwiki-archetype-macro/".
Then, by going through the new maven project wizard, I checked the
"include snapshot archetypes" box and the xwiki-archetype-macro shows
up. I then fill out the input boxes, for example something like:
Group ID: com.lyraphase
Artifact ID: localFileLinkMacro
Version: 0.0.1-SNAPSHOT
Package: com.lyraphase
I click finish and it simply says "Failed to create project". The
event details for the error in the log are:
--------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.php.product
Command-line arguments: -os win32 -ws win32 -arch x86 -product
org.eclipse.epp.package.php.product
Error
Tue May 25 18:28:55 MDT 2010
Failed to create project.
java.lang.NullPointerException
at
org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory.createArtifactRepository(DefaultArtifactRepositoryFactory.java:90)
at
org.maven.ide.eclipse.internal.project.ProjectConfigurationManager.resolveArchetype(ProjectConfigurationManager.java:540)
at
org.maven.ide.eclipse.internal.project.ProjectConfigurationManager.createArchetypeProject(ProjectConfigurationManager.java:463)
at
org.maven.ide.eclipse.wizards.MavenProjectWizard$5.runInWorkspace(MavenProjectWizard.java:279)
at
org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
--------------------------------------------
I then gave up on that, and just made a new directory and ran the
maven command line mentioned in the Macro Tutorial through Cygwin. I
entered the Group ID, etc...
The command seemed to work, however again m2eclipse chokes on missing
maven dependencies after doing a "Import -> Existing Maven Project".
The console log in Eclipse also shows *tons* of warnings about
checksums failing and some missing pom files. For example:
5/25/10 6:02:18 PM MDT: [WARN] *** CHECKSUM FAILED - Checksum failed
on download: local = 'f4993fe96db30ae57ca4d71e34ebe200b63981b6';
remote = 'eaf4f3d8c6ee17e73ca671a496a4b307f83aed63' - IGNORING
5/25/10 6:02:19 PM MDT: [WARN] *** CHECKSUM FAILED - Checksum failed
on download: local = 'aaeb993ef6348a2e5102df06b408d8bb220d609e';
remote = '79231f9f429a3ba10c5d260b4e683fe7599498d0' - IGNORING
Most of that stuff is uninteresting, but I snipped out some of the
more interesting messages I found within the mess.
--------------------------------------------
5/25/10 5:46:08 PM MDT: Unable to update index for
xwiki-externals|http://maven.xwiki.org/externals: Resource
nexus-maven-repository-index.properties does not exist
5/25/10 5:52:57 PM MDT: Missing artifact
org.xwiki.platform:xwiki-core-rendering-parser-wikimodel:jar:2.3-SNAPSHOT:compile
5/25/10 5:46:10 PM MDT: Unable to update index for
xwiki-plugins-externals|http://maven.xwiki.org/externals: Resource
nexus-maven-repository-index.properties does not exist
5/25/10 5:52:57 PM MDT: Missing artifact
org.xwiki.platform:xwiki-core-rendering-parser-wikimodel:jar:2.3-SNAPSHOT:compile
5/25/10 6:02:19 PM MDT: Missing artifact
org.xwiki.platform:xwiki-core-rendering-parser-wikimodel:jar:2.3-SNAPSHOT:compile
5/25/10 6:02:24 PM MDT: Maven Builder: FULL_BUILD
5/25/10 6:02:24 PM MDT: Build errors for localFileLinkMacro;
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal on project localFileLinkMacro: Missing:
----------
1) org.xwiki.platform:xwiki-core-rendering-parser-wikimodel: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-core-rendering-parser-wikimodel
-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-rendering-parser-wikimodel
-Dversion=2.3-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
-Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) com.lyraphase:localFileLinkMacro:pom:pom:1.0-SNAPSHOT
2) org.xwiki.platform:xwiki-core-rendering-parser-wikimodel:jar:2.3-SNAPSHOT
----------
1 required artifact is missing.
for artifact:
com.lyraphase:localFileLinkMacro:pom:1.0-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)
--------------------------------------------