Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Platform - User Assistance (UA) » Re: Howto pre-index help plugin outside eclipse
Re: Howto pre-index help plugin outside eclipse [message #474102] Wed, 25 June 2008 01:40 Go to next message
Eclipse UserFriend
Originally posted by: nospam_kowalskilee.gmail.com

Daffe wrote:
> Hi,
>
> I'm trying to pre-index my help plugin for my standalone infocenter, but
> I can not get it to work. I manage to get the index built in the product
> way by running the command mentioned in the help as shown below:
>
> eclipse -nosplash -application org.eclipse.help.base.indexTool -vmargs
> -DindexOutput=outputDirectory -DindexLocale=locale
>
> This worked fine but then I got index contributions from all other
> eclipse plugins within that eclipse installation. And I only what
> contributions from my plugin.
>
> What I want is some way of to automate the indexing from ant for my help
> plugin without using a complete eclipse installation or an eclipse
> project. I tried to copy the required jar files and create an ant build
> file in the following way:
>
> <project name="DocIndexTest" default="build.index" basedir=".">
>
> <taskdef name="help.buildHelpIndex"
> classname="org.eclipse.help.internal.base.ant.BuildHelpIndex "
> classpath=" lib/helpbase-ant.jar:lib/org.eclipse.equinox.common_3.2.0.v2 0060603.jar:lib/org.eclipse.help.base_3.2.0.v20060601.jar:li b/org.eclipse.osgi_3.2.0.v20060601.jar:lib/org.eclipse.core. runtime_3.2.0.v20060603.jar:lib/lucene-1.4.3.jar "/>
>
>
> <target name="build.index">
> <help.buildHelpIndex manifest="${basedir}/plugin.xml"
> destination="${basedir}"/> </target>
>
> </project>
>
> But when run this gives me the following NullPointerException.
>
> Caused by: java.lang.NullPointerException
> at
> org.eclipse.core.internal.runtime.InternalPlatform.getNL(Int ernalPlatform.java:500)
>
> at org.eclipse.core.runtime.Platform.getNL(Platform.java:1115)
> at
> org.eclipse.help.search.HelpIndexBuilder.processLocaleDir(He lpIndexBuilder.java:481)
>
> at
> org.eclipse.help.search.HelpIndexBuilder.execute(HelpIndexBu ilder.java:312)
> at
> org.eclipse.help.internal.base.ant.BuildHelpIndex.execute(Bu ildHelpIndex.java:66)
>
> at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.j ava:275)
> at org.apache.tools.ant.Task.perform(Task.java:364)
> ... 10 more
>
> Perhaps the locale needs to be set in some way?
>
> I also tried the idea of running java from ant by calling this command,
> even if I do not want contributions from other plugins:
>
> java -jar plugins/org.eclipse.equinox.launcher_1.0.0.v20070606.jar
> -nosplash -application org.eclipse.help.base.indexTool -vmargs
> -DindexOutput=indexed -DindexLocale=en
>
> but this gave me this exception even if the indexOutput is sent along as
> a vm parameter:
>
> java.lang.Exception: indexOutput property is not set.
> at
> org.eclipse.help.internal.base.IndexToolApplication.start(In dexToolAp
> plication.java:38)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandl
> e.java:169)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runAppli
> cation(EclipseAppLauncher.java:106)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(Ec
> lipseAppLauncher.java:76)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.ja
> va:363)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.ja
> va:176)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.
> java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAcces
> sorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
>
> Is there a way to pre-build this index in an automated way?
>
>
Re: Howto pre-index help plugin outside eclipse [message #474105 is a reply to message #474102] Wed, 25 June 2008 16:14 Go to previous message
Douglas Dirks is currently offline Douglas DirksFriend
Messages: 26
Registered: July 2009
Junior Member
Hi,

I've been able to automate building an index for each individual help
plugin, but my approach involves creating a the plugin unpacked (as a
directory rather than a jar file) and then launching Eclipse to call
antRunner,

Each help plugin has a build.xml file that looks like this:

<project name="IDL Analyst" default="build.index" basedir="." >
<target name="build.index" if="eclipse.running">
<eclipse.refreshLocal resource="${basedir}" depth="infinite" />
<help.buildHelpIndex manifest="${basedir}/plugin.xml"
destination="${basedir}"/>
</target>
</project>

I then invoke Eclipse using a Windows batch file. You say you don't want
to use a complete Eclipse installation or an Eclipse project -- why is
that? Or am I misunderstanding what you're looking for?

Here's the batch file I use, in all its un-cleaned-up glory. It'd be
easy enough to rewrite as a shell script, but we do our builds on a
Windows system. (Watch out for spurious line breaks in the below.)

Best of luck,
Doug

------------------------------------------------------------ --------
@echo off
REM This batch file calls ANT on an Eclipse project to build the
REM documentation plugin's full-text search index.
REM
REM syntax:
REM
REM indexbuild -plugdir com.rsi.idl.doc.test
REM
REM where the plugin directory is located relative to this
REM batch file.
REM

REM Specify path to Java executable
set vm=c:\\Java\\jre1.5.0_12\\bin\\java.exe

REM plugin directory (not used if you specify on command line)
set plugdir=com.rsi.idl.doc.test

REM reset list of ant targets to execute
set jobs=build.index

REM default switch to determine if eclipse should be reinstalled
REM between running of jobs
set installmode=clean

REM property file to pass to Ant scripts
set properties=

REM default values for os, ws and arch
set os=win32
set ws=win32
set arch=x86

REM The default location for the XML and HTML result files
set resultsDir=results

REM reset ant command line args
set ANT_CMD_LINE_ARGS=

:: set path to eclipse folder. If local folder, use '.';
:: otherwise, use c:\path\to\eclipse
:: set ECLIPSEHOME=.
set ECLIPSEHOME=c:\eclipse_3.3

:: get path to equinox jar inside ECLIPSEHOME folder
for /f "delims= tokens=1" %%c in ('dir /b
%ECLIPSEHOME%\plugins\org.eclipse.equinox.launcher_*') do set
EQUINOXJAR=%ECLIPSEHOME%\plugins\%%c

:processcmdlineargs

REM ************************************************************ ****
REM
REM Process command line arguments
REM
REM ************************************************************ ****

if x%1==x goto run
if x%1==x-plugdir set plugdir=%2 && shift && shift && goto
processcmdlineargs
if x%1==x-ws set ws=%2 && shift && shift && goto processcmdlineargs
if x%1==x-os set os=%2 && shift && shift && goto processcmdlineargs
if x%1==x-arch set arch=%2 && shift && shift && goto processcmdlineargs
if x%1==x-resultsDir set resultsDir=%2 && shift && shift && goto
processcmdlineargs
if x%1==x-noclean set installmode=noclean&& shift && goto
processcmdlineargs
if x%1==x-properties set properties=-propertyfile %2 && shift && shift &&
goto processcmdlineargs
if x%1==x-vm set vm=%2 && shift && shift && goto processcmdlineargs

set jobs=%jobs% %1 && shift && goto processcmdlineargs


:run
REM
************************************************************ ***************
REM Run jobs by running Ant in Eclipse on the test.xml script
REM
************************************************************ ***************
::echo plugdir is "%plugdir%"
::echo "%plugdir:~-1%"
REM If we got the plugdir from the command line, we need to strip
REM off a trailing space.
if "%plugdir:~-1%"==" " (set plugdir=%plugdir:~0,-1%)

set buildfile=%plugdir%\build.xml
::echo buildfile is %buildfile%

REM Remove any existing index files
del /q %plugdir%\index\*
del /q %plugdir%\index\*.*

REM Launch Eclipse and call antRunner to build the index
%vm% -cp "%EQUINOXJAR%" ^
-Dosgi.ws=%ws% ^
-Dosgi.os=%os% ^
-Dosgi.arch=%arch% ^
org.eclipse.equinox.launcher.Main -data workspace ^
-application org.eclipse.ant.core.antRunner -file %buildfile% %jobs% ^
-DresultsDir=%resultsDir% ^
-Dws=%ws% ^
-Dos=%os% ^
-Darch=%arch% ^
-Dplatform=%ws%.%os%.%arch% %properties% ^
-D%installmode%=true ^
-logger org.apache.tools.ant.DefaultLogger
goto end

:end
Re: Howto pre-index help plugin outside eclipse [message #617654 is a reply to message #474102] Wed, 25 June 2008 16:14 Go to previous message
Eclipse UserFriend
Originally posted by: ddirks.ittvis.com

Hi,

I've been able to automate building an index for each individual help
plugin, but my approach involves creating a the plugin unpacked (as a
directory rather than a jar file) and then launching Eclipse to call
antRunner,

Each help plugin has a build.xml file that looks like this:

<project name="IDL Analyst" default="build.index" basedir="." >
<target name="build.index" if="eclipse.running">
<eclipse.refreshLocal resource="${basedir}" depth="infinite" />
<help.buildHelpIndex manifest="${basedir}/plugin.xml"
destination="${basedir}"/>
</target>
</project>

I then invoke Eclipse using a Windows batch file. You say you don't want
to use a complete Eclipse installation or an Eclipse project -- why is
that? Or am I misunderstanding what you're looking for?

Here's the batch file I use, in all its un-cleaned-up glory. It'd be
easy enough to rewrite as a shell script, but we do our builds on a
Windows system. (Watch out for spurious line breaks in the below.)

Best of luck,
Doug

------------------------------------------------------------ --------
@echo off
REM This batch file calls ANT on an Eclipse project to build the
REM documentation plugin's full-text search index.
REM
REM syntax:
REM
REM indexbuild -plugdir com.rsi.idl.doc.test
REM
REM where the plugin directory is located relative to this
REM batch file.
REM

REM Specify path to Java executable
set vm=c:\\Java\\jre1.5.0_12\\bin\\java.exe

REM plugin directory (not used if you specify on command line)
set plugdir=com.rsi.idl.doc.test

REM reset list of ant targets to execute
set jobs=build.index

REM default switch to determine if eclipse should be reinstalled
REM between running of jobs
set installmode=clean

REM property file to pass to Ant scripts
set properties=

REM default values for os, ws and arch
set os=win32
set ws=win32
set arch=x86

REM The default location for the XML and HTML result files
set resultsDir=results

REM reset ant command line args
set ANT_CMD_LINE_ARGS=

:: set path to eclipse folder. If local folder, use '.';
:: otherwise, use c:\path\to\eclipse
:: set ECLIPSEHOME=.
set ECLIPSEHOME=c:\eclipse_3.3

:: get path to equinox jar inside ECLIPSEHOME folder
for /f "delims= tokens=1" %%c in ('dir /b
%ECLIPSEHOME%\plugins\org.eclipse.equinox.launcher_*') do set
EQUINOXJAR=%ECLIPSEHOME%\plugins\%%c

:processcmdlineargs

REM ************************************************************ ****
REM
REM Process command line arguments
REM
REM ************************************************************ ****

if x%1==x goto run
if x%1==x-plugdir set plugdir=%2 && shift && shift && goto
processcmdlineargs
if x%1==x-ws set ws=%2 && shift && shift && goto processcmdlineargs
if x%1==x-os set os=%2 && shift && shift && goto processcmdlineargs
if x%1==x-arch set arch=%2 && shift && shift && goto processcmdlineargs
if x%1==x-resultsDir set resultsDir=%2 && shift && shift && goto
processcmdlineargs
if x%1==x-noclean set installmode=noclean&& shift && goto
processcmdlineargs
if x%1==x-properties set properties=-propertyfile %2 && shift && shift &&
goto processcmdlineargs
if x%1==x-vm set vm=%2 && shift && shift && goto processcmdlineargs

set jobs=%jobs% %1 && shift && goto processcmdlineargs


:run
REM
************************************************************ ***************
REM Run jobs by running Ant in Eclipse on the test.xml script
REM
************************************************************ ***************
::echo plugdir is "%plugdir%"
::echo "%plugdir:~-1%"
REM If we got the plugdir from the command line, we need to strip
REM off a trailing space.
if "%plugdir:~-1%"==" " (set plugdir=%plugdir:~0,-1%)

set buildfile=%plugdir%\build.xml
::echo buildfile is %buildfile%

REM Remove any existing index files
del /q %plugdir%\index\*
del /q %plugdir%\index\*.*

REM Launch Eclipse and call antRunner to build the index
%vm% -cp "%EQUINOXJAR%" ^
-Dosgi.ws=%ws% ^
-Dosgi.os=%os% ^
-Dosgi.arch=%arch% ^
org.eclipse.equinox.launcher.Main -data workspace ^
-application org.eclipse.ant.core.antRunner -file %buildfile% %jobs% ^
-DresultsDir=%resultsDir% ^
-Dws=%ws% ^
-Dos=%os% ^
-Darch=%arch% ^
-Dplatform=%ws%.%os%.%arch% %properties% ^
-D%installmode%=true ^
-logger org.apache.tools.ant.DefaultLogger
goto end

:end
Previous Topic:"Suppress infopop when only one target" (bug 88822) update
Next Topic:Which plugin has eclipse welcomepage
Goto Forum:
  


Current Time: Mon Nov 04 15:47:20 GMT 2024

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

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

Back to the top