Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Mylyn » [wikitext] Use Wikitext with Maven/Tycho
[wikitext] Use Wikitext with Maven/Tycho [message #797823] Mon, 13 February 2012 23:13 Go to next message
Jens von Pilgrim is currently offline Jens von Pilgrim
Messages: 294
Registered: July 2009
Senior Member
Hi all,

I'm trying to set up an automatic build using Wikitext and Maven/Tycho.
Has anyone done that before?

The main problem is not use call the Wikitext anttasks from within
Maven, but how to retrieve them in the first place.

I found an example ant file not only executing the Wikitext anttasks,
but also downloading them when needed (an old Xtext ant task, seee [1]).
It seems as if this ant script is no longer maintained, as it contains
some bugs and some download locations are not available anymore.
Besides, as I'm using Tycho, all other (Eclipse) dependencies are
defined using p2 repositories, which is rather easy to handle.

I have included the Wikitext anttask into my Maven script, similar to
the Maven script of the Wikitext help.ui pom [2]:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<target>
<taskdef
resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties"
classpathref="maven.plugin.classpath" />
<wikitext-to-eclipse-help
markupLanguage="org.eclipse.mylyn.wikitext.textile.core.TextileLanguage"
helpPrefix="help"
dest="${basedir}">
<fileset dir="src/textiles" includes="**/*.textile"/>
</wikitext-to-eclipse-help>
...
</target>
</configuration>
<goals><goal>run</goal></goals>
</execution>
</executions>
...

This is not working, as the resource
"org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties" is not
found in the taskdef task. This properties file is part of the
org.eclipse.mylyn.wikitext.core bundle, so I tried to let Maven download
that bundle somehow.

I have tried to add the Maven update site to the list of repositories as
follows:

<repository>
<id>mylyn-weekly</id>
<url>http://download.eclipse.org/mylyn/snapshots/weekly</url>
<layout>default</layout>
</repository>

This does not work as the update site is not a Maven repository:

[WARNING] The POM for
org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.core:jar:1.6.0 is
missing, no dependency information available
[WARNING] The POM for
org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.textile.core:jar:1.6.0
is missing, no dependency information available

So I changed the layout to p2:

<repository>
<id>mylyn-weekly</id>
<url>http://download.eclipse.org/mylyn/snapshots/weekly</url>
<layout>p2</layout>
</repository>


With this setting, the wikitext bundle is successfully downloaded when a
plugin dependency such as

Require-Bundle: org.eclipse.mylyn.wikitext.core;bundle-version="1.6.0"

is defined. However, in my case it is not a plugin dependency, but the
ant task defined in this plugin is required during build time. That is,
the bundle is available for compilation purposes, but not for loading
classes from it via taskdef.

In [2], the following dependency

<dependency>
<groupId>org.eclipse.mylyn.docs</groupId>
<artifactId>org.eclipse.mylyn.wikitext.core</artifactId>
<version>1.6.0</version>
</dependency>

can be resolved, but unlike the wikitext build system, the wikitext
artifact is not created in my build. Apparently, Maven cannot resolve a
dependency using the artifactId when the artifact is a bundle and the
repository is a p2 update site. Or do I simply have to change the
artifactId?

Maybe it comes down to the question on how to enable third party
anttasks defined in a p2 repository and defined with ant's taskdef, to
be used in a Maven/Tycho build.

Cheers,
Jens



[1]
http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.tmf/org.eclipse.xtext/plugins/org.eclipse.xtext.doc/customBuild.xml?root=Modeling_Project&view=log

[2]
http://git.eclipse.org/c/mylyn/org.eclipse.mylyn.docs.git/tree/org.eclipse.mylyn.wikitext.help.ui/pom.xml
Re: [wikitext] Use Wikitext with Maven/Tycho [message #798223 is a reply to message #797823] Tue, 14 February 2012 11:50 Go to previous messageGo to next message
Jens von Pilgrim is currently offline Jens von Pilgrim
Messages: 294
Registered: July 2009
Senior Member
OK, to answer my own question:

Problem:
wikitext ant tasks are required in maven based build

Solution:

1)
Specify wikitext repository using Tycho in your pom:

--------8X--------8X--------8X--------8X--------8X--------8X--------
...
<repositories>
<repository>
<id>wikitext</id>
<layout>p2</layout>

<url>http://download.eclipse.org/tools/mylyn/update/weekly</url>
</repository>
</repositories>
...
--------8X--------8X--------8X--------8X--------8X--------8X--------

2)
Define a dependency to the required wikitext plugins in your Eclipse
(doc) project. Since you do not want to have this dependency at runtime,
add it in the build.properties using jars.extra.classpath, e.g.:

--------8X--------8X--------8X--------8X--------8X--------8X--------
bin.includes = META-INF/
jars.extra.classpath = \
platform:/plugin/org.eclipse.mylyn.wikitext.core,\
platform:/plugin/org.eclipse.mylyn.wikitext.textile.core
--------8X--------8X--------8X--------8X--------8X--------8X--------

3)
Pass the maven classpath to ant. The following snippet is taken from the
pom creating some Eclipse help fom textile files. The ant script is
defined in its own file:

--------8X--------8X--------8X--------8X--------8X--------8X--------
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<tasks>
<property name="compile_classpath"
refid="maven.compile.classpath"/>
<ant target="all" inheritRefs="true"
antfile="build-help.xml"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
--------8X--------8X--------8X--------8X--------8X--------8X--------

4)
Define the task in the ant script, using the class path passed from
maven. The following script (build-help.xml) is included in the pom in
step 3.

--------8X--------8X--------8X--------8X--------8X--------8X--------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<project name="de.jevopi.mitra2.doc" basedir="." default="all">
<path id="wikitext.tasks.classpath">
<pathelement path="${compile_classpath}"/>
</path>
<taskdef classpathref="wikitext.tasks.classpath"
resource=
"org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties"/>

<target name="all" description="Generate help">
<wikitext-to-eclipse-help
markupLanguage="org.eclipse.mylyn.wikitext.textile.core.TextileLanguage"
multipleOutputFiles="true"
navigationImages="true"
helpPrefix="help">

<fileset dir="src/textile" includes="**/*.textile"/>
</wikitext-to-eclipse-help>
</target>
</project>
--------8X--------8X--------8X--------8X--------8X--------8X--------

Cheers,
Jens

P.S.: Now I have new questions, e.g., how to separate the source textile
files from the generated output, as wikitext-to-eclipse-help does not
support destination files, does it?
Re: [wikitext] Use Wikitext with Maven/Tycho [message #802985 is a reply to message #798223] Mon, 20 February 2012 19:17 Go to previous messageGo to next message
David Green is currently offline David Green
Messages: 135
Registered: July 2009
Senior Member
Jens,

Looks like you're making good progress. You should take a look at the
existing poms, which build Mylyn WikiText with Maven and Tycho. An
example of these in action can be found here:
https://hudson.eclipse.org/hudson/job/mylyn-docs-nightly/

As for separating the source Textile from the generated output, why
would you want to do that? The source Textile is referenced from the
help content as an example of Textile.

David

On 2/14/2012 3:50 AM, Jens v.P. wrote:
> <pathelement path="${compile_classpath}"/>
> </path>
> <taskdef classpathref="wikitext.tasks.classpath"
> resource=
> "org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties"/>
>
> <target name="all" description="Generate help">
> <wikitext-to-eclipse-help
> markupLanguage="org.eclipse.mylyn.wikitext.textile.core.TextileLanguage"
> multipleOutputFiles="true"
> navigationImages="true"
> helpPrefix="help">
>
> <fileset dir="src/textile" includes="**/*.textile"/>
> </wikitext-to-eclipse-help>
> </target>
> </project>
> --------8X--------8X--------8X--------8X--------8X--------8X--------
>
> Cheers,
> Jens
>
> P.S.: Now I have new questions, e.g., how to separate the source textile
> files from the generated output, as wikitext-to-eclipse-help does not
> support destination files, does it?
Re: [wikitext] Use Wikitext with Maven/Tycho [message #803392 is a reply to message #802985] Tue, 21 February 2012 09:29 Go to previous messageGo to next message
Jens von Pilgrim is currently offline Jens von Pilgrim
Messages: 294
Registered: July 2009
Senior Member
David,

On 20.02.12 20:17, David Green wrote:
> You should take a look at the
> existing poms, which build Mylyn WikiText with Maven and Tycho. An
> example of these in action can be found here:
> https://hudson.eclipse.org/hudson/job/mylyn-docs-nightly/

Yes, thank you! Fortunately, my poms are working know. I have used a
mixture of the GMF tooling project structure and Chris' Minerva project
as templates. They are more or less complete (e.g., they create a P2
repository, tests are executed, and even Javadoc is created). I have
already used this set up for GEF3D.

> As for separating the source Textile from the generated output, why
> would you want to do that? The source Textile is referenced from the
> help content as an example of Textile.

Well, I figure this is a special case. Usually, you do not want to link
to the sources. For me, the textile files are raw source files (just
like Java files), from which I later create html and pdf documentation.

I have solved that problem by first merging all textile (in src/textile)
files into one big file (in help/main.textile). I then create the (one)
html files (one file is OK at the moment, I will think about splitting
up the file when needed) and the pdf from that one.

If anyone is interested in my solution, it is available at
http://mitra2.org (it's an Eclipselabs project).

Cheers,
Jens
Re: [wikitext] Use Wikitext with Maven/Tycho [message #803836 is a reply to message #803392] Tue, 21 February 2012 22:02 Go to previous messageGo to next message
David Green is currently offline David Green
Messages: 135
Registered: July 2009
Senior Member
Jens,

On 2/21/2012 1:29 AM, Jens v.P. wrote:
>> As for separating the source Textile from the generated output, why
>> would you want to do that? The source Textile is referenced from the
>> help content as an example of Textile.
>
> Well, I figure this is a special case. Usually, you do not want to link
> to the sources. For me, the textile files are raw source files (just
> like Java files), from which I later create html and pdf documentation.

Feel free to file an enhancement request!

David
Re: [wikitext] Use Wikitext with Maven/Tycho [message #804189 is a reply to message #803836] Wed, 22 February 2012 09:54 Go to previous message
Jens von Pilgrim is currently offline Jens von Pilgrim
Messages: 294
Registered: July 2009
Senior Member
David,

On 21.02.12 23:02, David Green wrote:
> Feel free to file an enhancement request!

Would have no problem with that, however the solution is quite simple:
This is a snippet from my ant script, which is invoked by the maven
build. The snippet is shamelessly stolen from an old Xtext build script:


<target name="assemble">
<loadfile
srcfile="${doc.source.dir}/index.txt"
property="inputfiles">
<filterchain>
<tokenfilter>
<replacestring from="\n" to=","/>
</tokenfilter>
</filterchain>
</loadfile>
<concat
destfile="${doc.build.dir}/Documentation.textile"
append="false" fixlastline="yes">
<filelist dir="${doc.source.dir}" files="${inputfiles}"/>
</concat>
<copy todir="${doc.build.dir}/fig">
<fileset dir="${doc.source.dir}/fig"/>
</copy>
</target>

The idea is really nice (kudos to Peter Friese or whoever did that at
itemis), as you cannot only separate source from build folder, but also
the structure of the sources from the structure of the target document.

The "index.txt" file contains the source files with chapters, or
whatever parts you like. In my case, it looks like that:

000-overview.textile
110-structure.textile
120-typesystem.textile
130-rules.textile
140-expressions.textile
150-statements.textile
...

This works, as textile sources can simply be merged by copying them
together (this wouldn't work with HTML).

Cheers,
Jens
Previous Topic:[wikitext] Programaticaly open MarkupEditor
Next Topic:"No search provider was registed. Tasks search is not available."
Goto Forum:
  


Current Time: Tue Sep 30 17:53:33 GMT 2014

Powered by FUDForum. Page generated in 0.02108 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software