如何编译xslt2-transformer.oxt LibreOffice扩展

时间:2017-09-20 19:47:59

标签: java libreoffice

我正在尝试编译xslt2-transformer扩展程序,因为我无法在网站上找到LibreOffice扩展程序xslt2-transformer.oxt(如果有人拥有它,欢迎他)。

要从源代码构建,我继续这样做:

$ git clone https://github.com/dtardon/xslt2-transformer.git
$ cd xslt2-transformer/
$ make

我在构建期间遇到了很多(类似的)错误:

mkdir -p build/classes && \
    javac -d build/classes -source 1.5 -target 1.5 \
          -cp "external/saxon9.jar:" com/sun/star/comp/xsltfilter/Base64.java \
          com/sun/star/comp/xsltfilter/XSLTFilterOLEExtracter.java \
          com/sun/star/comp/xsltfilter/XSLTransformer.java && \
    touch build/javac.done
com/sun/star/comp/xsltfilter/XSLTFilterOLEExtracter.java:27: error: package com.sun.star.bridge does not exist
import com.sun.star.bridge.XBridgeFactory;
                          ^
com/sun/star/comp/xsltfilter/XSLTFilterOLEExtracter.java:28: error: package com.sun.star.bridge does not exist
import com.sun.star.bridge.XBridge;
                          ^
[...]
  symbol:   class XConnector
  location: class XSLTFilterOLEExtracter
com/sun/star/comp/xsltfilter/XSLTFilterOLEExtracter.java:321: error: cannot find symbol
        XConnector xConnector = UnoRuntime.queryInterface(XConnector.class, x);
                                                          ^
  symbol:   class XConnector
  location: class XSLTFilterOLEExtracter
100 errors
1 warning
make: *** [build/javac.done] Error 1

我认为我的CLASSPATH不是最新的。我需要添加com.sun.star包和类。

由于我(当前)在OSX上,我的LibreOffice安装在/Applications/LibreOffice.app上,我在./Contents/Resources/java找到了一些类。

所以我以这种方式更新CLASSPATH

export CLASSPATH=/Applications/LibreOffice.app/Contents/Resources/java:$CLASSPATH

但是,我有同样的错误。我该如何解决这个问题?

编辑1 CLASSPATH

中添加了一些jar

我试过了:

$ export CLASSPATH=/Applications/LibreOffice.app/Contents//Resources/java/ridl.jar:.

我的错误较少。

编辑2 构建成功!

我最后将以下jar文件添加到CLASSPATH

/Applications/LibreOffice.app/Contents//Resources/java/ridl.jar
/Applications/LibreOffice.app/Contents//Resources/java/jurt.jar
/Applications/LibreOffice.app/Contents//Resources/java/juh.jar
/Applications/LibreOffice.app/Contents//Resources/java/unoil.jar

我得到了扩展名!

1 个答案:

答案 0 :(得分:1)

最后,为了从源代码构建,我继续这样做:

git clone https://github.com/dtardon/xslt2-transformer.git

cd xslt2-transformer/

export CLASSPATH=/Applications/LibreOffice.app/Contents/Resources/java/ridl.jar:\
/Applications/LibreOffice.app/Contents/Resources/java/jurt.jar:\
/Applications/LibreOffice.app/Contents/Resources/java/juh.jar:\
/Applications/LibreOffice.app/Contents/Resources/java/unoil.jar

make

结果为build/xslt2-transformer.oxt