Page 1 of 1

Unable to build from trunk source

PostPosted: Thu Apr 29, 2010 6:36 am
by kkkppp
I just checked out sources from SVN, trying to build according to http://dev.plutext.org/trac/docx4j/wiki/DevEnv

mvn install fails, below is the output. As I understand, PresentationMLPackage is in src/pptx4j directory, not src/main, how do I fix it?

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building docx4j
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [build-helper:add-source {execution: add-source}]
[INFO] Source directory: E:\tmp\docx4j-2.3.0\src\docx4j\src\diffx added.
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 1440 source files to E:\tmp\docx4j-2.3.0\src\docx4j\bin
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

E:\tmp\docx4j-2.3.0\src\docx4j\src\main\java\org\docx4j\openpackaging\contenttype\ContentTypeManager.java:[70,40] cannot find symbol
symbol : class PresentationMLPackage
location: package org.docx4j.openpackaging.packages

E:\tmp\docx4j-2.3.0\src\docx4j\src\main\java\org\docx4j\openpackaging\contenttype\ContentTypeManager.java:[80,52] package org.docx4j.openpackaging.parts.PresentationML does not exist

E:\tmp\docx4j-2.3.0\src\docx4j\src\main\java\org\docx4j\jaxb\NamespacePrefixMapperRelationshipsPartSunInternal.java:[23,107] package com.sun.xml.internal.bind.marshaller does not exist

E:\tmp\docx4j-2.3.0\src\docx4j\src\main\java\org\docx4j\jaxb\NamespacePrefixMapperSunInternal.java:[30,90] package com.sun.xml.internal.bind.marshaller does not exist

E:\tmp\docx4j-2.3.0\src\docx4j\src\main\java\org\docx4j\convert\in\FlatOpcXmlImporter.java:[53,40] cannot find symbol
symbol : class PresentationMLPackage
location: package org.docx4j.openpackaging.packages

E:\tmp\docx4j-2.3.0\src\docx4j\src\main\java\org\docx4j\convert\in\FlatOpcXmlImporter.java:[58,52] package org.docx4j.openpackaging.parts.PresentationML does not exist

E:\tmp\docx4j-2.3.0\src\docx4j\src\main\java\org\docx4j\openpackaging\contenttype\ContentTypeManager.java:[348,10] cannot find symbol
symbol : variable JaxbPmlPart
location: class org.docx4j.openpackaging.contenttype.ContentTypeManager

E:\tmp\docx4j-2.3.0\src\docx4j\src\main\java\org\docx4j\openpackaging\contenttype\ContentTypeManager.java:[714,11] cannot find symbol
symbol : class PresentationMLPackage
location: class org.docx4j.openpackaging.contenttype.ContentTypeManager

E:\tmp\docx4j-2.3.0\src\docx4j\src\main\java\org\docx4j\jaxb\NamespacePrefixMapperUtils.java:[29,16] incompatible types
found : org.docx4j.jaxb.NamespacePrefixMapperSunInternal
required: java.lang.Object

E:\tmp\docx4j-2.3.0\src\docx4j\src\main\java\org\docx4j\jaxb\NamespacePrefixMapperUtils.java:[50,16] incompatible types
found : org.docx4j.jaxb.NamespacePrefixMapperRelationshipsPartSunInternal
required: java.lang.Object

E:\tmp\docx4j-2.3.0\src\docx4j\src\main\java\org\docx4j\convert\in\FlatOpcXmlImporter.java:[147,24] cannot find symbol
symbol : class PresentationMLPackage
location: class org.docx4j.convert.in.FlatOpcXmlImporter

E:\tmp\docx4j-2.3.0\src\docx4j\src\main\java\org\docx4j\convert\in\FlatOpcXmlImporter.java:[438,31] cannot find symbol
symbol : class JaxbPmlPart
location: class org.docx4j.convert.in.FlatOpcXmlImporter

E:\tmp\docx4j-2.3.0\src\docx4j\src\main\java\org\docx4j\convert\in\FlatOpcXmlImporter.java:[442,86] package org.pptx4j.jaxb does not exist

E:\tmp\docx4j-2.3.0\src\docx4j\src\main\java\org\merlin\io\DOMSerializerEngine.java:[111,69] com.sun.org.apache.xerces.internal.util.EncodingMap is Sun proprietary API and may be removed in a future release


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12 seconds
[INFO] Finished at: Wed Apr 28 22:37:11 MSD 2010
[INFO] Final Memory: 38M/420M
[INFO] ------------------------------------------------------------------------

Re: Unable to build from trunk source

PostPosted: Thu Apr 29, 2010 9:34 am
by jason
Ignore the error; I don't use mvn to do the build.

Go on and run:
Code: Select all
ANT_OPTS="-Xmx512m -XX:MaxPermSize=256m" ant dist

Re: Unable to build from trunk source

PostPosted: Thu Apr 29, 2010 3:28 pm
by kkkppp
Thanks for quick response.

I tried to run just ant, but there are few problems too.

- <property name="m2Repository" value="../../.m2/repository"/> points to unexistent directory
- when I tried to replace property above by patch to m2 directory in my working copy, I got bunch of compilation errors as it doesn't contain commons-vfs-patched-1.9.1, only 1.1.1
- I solved that by replacing property by path to my own maven, but compile failed because of missing jaxb, so I added this

+ <pathelement location="${m2Repository}/com/sun/xml/bind/jaxb-impl/2.1.3/jaxb-impl-2.1.3.jar" />

Re: Unable to build from trunk source

PostPosted: Wed May 05, 2010 9:01 pm
by bonzai
I'm completely stuck with the building now. When I run "ant dist" here is what I get:

Code: Select all
Buildfile: build.xml

clean:
   [delete] Deleting directory C:\Users\smonte\workspace\docx4j\bin

init:
    [mkdir] Created dir: C:\Users\smonte\workspace\docx4j\bin
     [copy] Copying 28 files to C:\Users\smonte\workspace\docx4j\bin

build-project:
     [echo] docx4j: C:\Users\smonte\workspace\docx4j\build.xml
     [echo] 1.5
    [javac] Compiling 1803 source files to C:\Users\smonte\workspace\docx4j\bin
    [javac] C:\Users\smonte\workspace\docx4j\src\main\java\org\docx4j\jaxb\Names
pacePrefixMapper.java:30: package com.sun.xml.bind.marshaller does not exist
    [javac] public class NamespacePrefixMapper extends com.sun.xml.bind.marshall
er.NamespacePrefixMapper {
    [javac]
  ^
    [javac] C:\Users\smonte\workspace\docx4j\src\main\java\org\docx4j\jaxb\Names
pacePrefixMapperRelationshipsPart.java:23: package com.sun.xml.bind.marshaller d
oes not exist
    [javac] public class NamespacePrefixMapperRelationshipsPart extends com.sun.
xml.bind.marshaller.NamespacePrefixMapper {
    [javac]
                   ^
    [javac] C:\Users\smonte\workspace\docx4j\src\main\java\org\docx4j\convert\ou
t\html\AbstractHtmlExporter.java:180: cannot find symbol
    [javac] symbol  : method setTextContent(java.lang.String)
    [javac] location: interface org.w3c.dom.Element
    [javac]                             spanElement.setTextContent(triple.getBul
let() + " " );
    [javac]                                        ^
    [javac] C:\Users\smonte\workspace\docx4j\src\main\java\org\docx4j\convert\ou
t\html\AbstractHtmlExporter.java:183: cannot find symbol
    [javac] symbol  : method setTextContent(java.lang.String)
    [javac] location: interface org.w3c.dom.Element
    [javac]                             spanElement.setTextContent("?");

    [javac]                                        ^
    [javac] C:\Users\smonte\workspace\docx4j\src\main\java\org\docx4j\model\tabl
e\TableModel.java:492: cannot find symbol
    [javac] symbol  : method getTextContent()
    [javac] location: interface org.w3c.dom.Node
    [javac]                     System.out.println(children.item(i).getTextConte
nt());
    [javac]                                                        ^
    [javac] C:\Users\smonte\workspace\docx4j\src\main\java\org\docx4j\convert\ou
t\pdf\viaXSLFO\Conversion.java:466: cannot find symbol
    [javac] symbol  : method setTextContent(java.lang.String)
    [javac] location: interface org.w3c.dom.Element
    [javac]                                     foListItemLabelBody.setTextConte
nt("?");
    [javac]                                                        ^
    [javac] C:\Users\smonte\workspace\docx4j\src\main\java\org\docx4j\convert\ou
t\pdf\viaXSLFO\Conversion.java:486: cannot find symbol
    [javac] symbol  : method setTextContent(java.lang.String)
    [javac] location: interface org.w3c.dom.Element
    [javac]                                     foListItemLabelBody.setTextConte
nt(triple.getBullet() );
    [javac]                                                        ^
    [javac] C:\Users\smonte\workspace\docx4j\src\main\java\org\docx4j\convert\ou
t\pdf\viaXSLFO\Conversion.java:489: cannot find symbol
    [javac] symbol  : method setTextContent(java.lang.String)
    [javac] location: interface org.w3c.dom.Element
    [javac]                                             foListItemLabelBody.setT
extContent("?");
    [javac]                                                                ^
    [javac] C:\Users\smonte\workspace\docx4j\src\main\java\org\docx4j\convert\ou
t\pdf\viaXSLFO\Conversion.java:530: cannot find symbol
    [javac] symbol  : method setTextContent(java.lang.String)
    [javac] location: interface org.w3c.dom.Element
    [javac]                             foBlockElement.setTextContent(" ");
    [javac]                                           ^
    [javac] C:\Users\smonte\workspace\docx4j\src\main\java\org\docx4j\jaxb\Names
pacePrefixMapperUtils.java:18: incompatible types
    [javac] found   : org.docx4j.jaxb.NamespacePrefixMapper
    [javac] required: java.lang.Object
    [javac]                     return new NamespacePrefixMapper();
    [javac]                            ^
    [javac] C:\Users\smonte\workspace\docx4j\src\main\java\org\docx4j\jaxb\Names
pacePrefixMapperUtils.java:39: incompatible types
    [javac] found   : org.docx4j.jaxb.NamespacePrefixMapperRelationshipsPart
    [javac] required: java.lang.Object
    [javac]                     return new NamespacePrefixMapperRelationshipsPar
t();
    [javac]                            ^
    [javac] C:\Users\smonte\workspace\docx4j\src\diffx\com\topologi\diffx\algori
thm\DiffXFactory.java:150: warning: non-varargs call of varargs method with inex
act argument type for last parameter;
    [javac] cast to java.lang.Object for a varargs call
    [javac] cast to java.lang.Object[] for a non-varargs call and to suppress th
is warning
    [javac]       diffex = (DiffXAlgorithm)cons.newInstance(new EventSequence[]{
sequence1, sequence2});
    [javac]                                                 ^
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 11 errors
    [javac] 1 warning

BUILD FAILED
C:\Users\smonte\workspace\docx4j\build.xml:83: Compile failed; see the compiler
error output for details.

Total time: 13 seconds


Any ideas? Thanks in advance!

Re: Unable to build from trunk source

PostPosted: Wed May 05, 2010 9:58 pm
by jason
Looks like you have 2 problems:

1. Do you have the xml api's on your path (or provided by the JDK?). In build.xml, this is <pathelement location="${m2Repository}/xml-apis/xml-apis/1.3.03/xml-apis-1.3.03.jar"/>

2. To build, you need both the JAXB included in the JDK, and the reference implementation (RI). If you don't have the RI in your endorsed dir, you'll need to add it to your build.xml (as kkkppp did earlier in this thread).

Out of interest, what IDE do you use?

Re: Unable to build from trunk source

PostPosted: Thu May 06, 2010 12:17 am
by bonzai
Hey,

I finally managed to get the .jar file out, thanks to your help! I added the JAXB to classpath and also downloaded the xml-apis-1.3.03.jar and put it in the ".m2/..." folder. I still don't understand why Maven didn't add all the necessary .jar files (in this case the xml-apis-1.3.03.jar), but I'm happy with the end result :)

And I'm using Eclipse (without Maven as I'm not familiar with that)

Re: Unable to build from trunk source

PostPosted: Fri May 07, 2010 12:27 am
by bonzai
Everything is almost working, I just have one question.

I made some minor changes to "SvgExporter.java", then ran "ant dist" and got the docx4j.jar out. However, the code fails in

Code: Select all
PresentationMLPackage source = PresentationMLPackage.load(someFile);


Here is what I get:

Code: Select all
JAXB: Using RI
2010-05-06 15:22:37,970 INFO [org.pptx4j.jaxb.Context] - <loading Context jcPML>
2010-05-06 15:22:38,373 INFO [org.pptx4j.jaxb.Context] - <.. loaded ..>
2010-05-06 15:22:38,378 WARN [org.docx4j.jaxb.JaxbValidationEventHandler] - <[(non)FATAL_ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/presentationml/2006/main", local:"presentation"). Expected el>
2010-05-06 15:22:38,379 INFO [org.docx4j.jaxb.JaxbValidationEventHandler] - <continuing (with possible element/attribute loss)>
2010-05-06 15:22:38,379 ERROR [org.docx4j.openpackaging.parts.Part] - <javax.xml.bind.UnmarshalException: unexpected element (uri:"http://schemas.openxmlformats.org/presentationml/2006/main", local:"presentation"). Expected elements are <{http://schemas.openxmlformats.org/drawingml/2006/main}blip>,<{http://schemas.openxmlformats.org/presentationml/2006/main}cmAuthorLst>,<{http://schemas.openxmlformats.org/presentationml/2006/main}cmLst>,<{http://schemas.openxmlformats.org/drawingml/2006/main}graphic>,<{}handoutMaster>,<{}notes>,<{}notesMaster>,<{http://schemas.openxmlformats.org/presentationml/2006/main}oleObj>,<{http://schemas.openxmlformats.org/drawingml/2006/picture}pic>,<{}presentation>,<{}presentationPr>,<{}sld>,<{}sldLayout>,<{}sldMaster>,<{http://schemas.openxmlformats.org/presentationml/2006/main}sldSyncPr>,<{}sp>,<{}tagLst>,<{http://schemas.openxmlformats.org/drawingml/2006/main}tbl>,<{http://schemas.openxmlformats.org/drawingml/2006/main}tblStyleLst>,<{http://schemas.openxmlformats.org/drawingml/2006/main}theme>,<{http://schemas.openxmlformats.org/drawingml/2006/main}themeManager>,<{http://schemas.openxmlformats.org/drawingml/2006/main}themeOverride>,<{}viewPr>>
javax.xml.bind.UnmarshalException: unexpected element (uri:"http://schemas.openxmlformats.org/presentationml/2006/main", local:"presentation"). Expected elements are <{http://schemas.openxmlformats.org/drawingml/2006/main}blip>,<{http://schemas.openxmlformats.org/presentationml/2006/main}cmAuthorLst>,<{http://schemas.openxmlformats.org/presentationml/2006/main}cmLst>,<{http://schemas.openxmlformats.org/drawingml/2006/main}graphic>,<{}handoutMaster>,<{}notes>,<{}notesMaster>,<{http://schemas.openxmlformats.org/presentationml/2006/main}oleObj>,<{http://schemas.openxmlformats.org/drawingml/2006/picture}pic>,<{}presentation>,<{}presentationPr>,<{}sld>,<{}sldLayout>,<{}sldMaster>,<{http://schemas.openxmlformats.org/presentationml/2006/main}sldSyncPr>,<{}sp>,<{}tagLst>,<{http://schemas.openxmlformats.org/drawingml/2006/main}tbl>,<{http://schemas.openxmlformats.org/drawingml/2006/main}tblStyleLst>,<{http://schemas.openxmlformats.org/drawingml/2006/main}theme>,<{http://schemas.openxmlformats.org/drawingml/2006/main}themeManager>,<{http://schemas.openxmlformats.org/drawingml/2006/main}themeOverride>,<{}viewPr>
   at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:556)

...


But then on the other hand, if I use "docx4j-nightly-20100422.jar" and just replace the "SvgExporter.class" with my own, the code runs perfect. Am I missing something in when buildining the jar?

Re: Unable to build from trunk source

PostPosted: Fri May 07, 2010 1:34 am
by jason
Could you please try the build.xml file I've just committed? I'm pretty confident it will fix the problem.

Have a read of this note:
Code: Select all
        <!--  Force ant to compile package-info.java.
              Without these, you'll get JAXB "unexpected element" errors.
             This is necessary because of a dubious change in ant behaviour,
              starting with 1.7.1 (see javac task doc, and ant bug 43114). 
             
           "In Ant 1.7.1 the package-info.java will only be compiled if:
            
               1. If a package-info.class file exists and is older than the package-info.java file.
               2. If the directory for the package-info.class file does not exist.
               3. If the directory for the package-info.class file exists, and has an older modification
               time than the the package-info.java file. In this case <javac> will touch the corresponding
               .class directory on successful compilation."             
              -->


That workaround I was applying to the main docx4j source tree; with this commit, it is also applied to the pptx4j bit.

Re: Unable to build from trunk source

PostPosted: Fri May 07, 2010 9:23 pm
by bonzai
Yep that did the trick!