facebook

cvc-elt.1: Cannot find the declaration of element ‘project’

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #229162 Reply

    Pedro Rozo
    Member

    Hi

    I am getting this message during the validation phase of all my maven projects:

    cvc-elt.1: Cannot find the declaration of element ‘project’. maven.xml

    I found a similar message in your 3.8.1 bugs forums, but I didn’t find the final solution there.

    http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-3480-highlight-cannot+declaration+element+project+maven+xml.html

    Currently I am running eclipse 3.0.1, myeclipse 3.8.4 and maven 1.0.2

    Do I need to add any specific XML namespace declaration within myeclipse xml configuration ?

    Pedro Rozo
    vancouver, BC
    Canada

    #229165 Reply

    Riyad Kalla
    Member

    Do I need to add any specific XML namespace declaration within myeclipse xml configuration ?

    Possibly, can you paste the contents of your XML file so we can try and duplicate what is happening over here?

    #229177 Reply

    Pedro Rozo
    Member

    Ok, Here my XML file: maven.xml.

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <project xmlns:j=”jelly:core” xmlns:ant=”jelly:ant” xmlns:maven=”jelly:maven” default=”copylib”>

    <j:set var=”project.ear.dep.includes” value=””/>
    <j:set var=”project.ear.dep.names” value=””/>
    <j:forEach var=”dep” items=”${pom.dependencies}”>
    <j:set var=”project.ear.dep.includes” value=”${dep.getArtifactId()}/project.xml,${project.ear.dep.includes}”/>
    <j:set var=”project.ear.dep.names” value=”${dep.getArtifactId()}-${dep.getVersion()}.*,${project.ear.dep.names}”/>
    </j:forEach>
    <echo>Dependent project POMs: ${project.ear.dep.includes}</echo>

    <goal name=”copylib” description=”Copy project libraries”>
    <j:forEach var=”lib” items=”${pom.artifacts}”>
    <j:set var=”dep” value=”${lib.dependency}”/>
    <j:if test=”${dep.getProperty(‘ear.bundle’)==’true’ || dep.getProperty(‘ear.module’)==’true’}”>
    <j:set var=”bundleDir” value=”${dep.getProperty(‘ear.bundle.dir’)}”/>
    <j:if test=”${!empty(bundleDir)}”>
    <j:set var=”bundleName” value=”${dep.getProperty(‘ear.bundle.name’)}”/>
    <j:if test=”${empty(bundleName)}”>
    <j:set var=”bundleName” value=”${lib.name}”/>
    </j:if>
    <j:set var=”bundlePath” value=”${bundleDir}/${bundleName}”/>

    <echo>Copying ${lib.file.name} as ${bundlePath}</echo>
    <ant:copy file=”${lib.file.parent}/${lib.file.name}” tofile=”${bundlePath}”/>
    </j:if>
    </j:if>
    </j:forEach>
    </goal>

    <preGoal name=”ear:ear”>
    <ant:move file=”${basedir}/META-INF/application.xml” tofile=”${basedir}/application.xml.orig”/>
    <ant:move file=”${basedir}/META-INF/maven-application.xml” tofile=”${basedir}/META-INF/application.xml”/>
    </preGoal>

    <postGoal name=”ear:ear”>
    <ant:move file=”${basedir}/META-INF/application.xml” tofile=”${basedir}/META-INF/maven-application.xml”/>
    <ant:move file=”${basedir}/application.xml.orig” tofile=”${basedir}/META-INF/application.xml”/>
    </postGoal>

    <goal name=”build”>
    <attainGoal name=”ear:install”/>
    </goal>

    <goal name=”project:build”>
    <maven:reactor
    basedir=”..”
    banner=”Build project dependencies”
    includes=”${project.ear.dep.includes}”
    excludes=”${pom.artifactId}/project.xml”
    postProcessing=”true”
    goals=”build”
    ignoreFailures=”true”
    />
    <attainGoal name=”ear:install”/>
    </goal>

    <goal name=”cleanlib”>
    <ant:delete>
    <ant:fileset dir=”APP-INF/lib” includes=”**”/>
    </ant:delete>
    </goal>

    <postGoal name=”eclipse”>
    <attainGoal name=”copylib”/>
    </postGoal>

    </project>

    #229183 Reply

    Riyad Kalla
    Member

    Yes the problem is you are missing a doctype or schema reference for this file.

    #229195 Reply

    Pedro Rozo
    Member

    I am not completely familiar with the maven XML schemas so Could you send me an example of a validated maven.xml file in Myeclipse to compare and see ho can I fix this topic?

    #229208 Reply

    Riyad Kalla
    Member

    I am not completely familiar with the maven XML schemas so Could you send me an example of a validated maven.xml

    Hmmm I’ve never used Maven, and as far as MyEclipse all it is doing to validate your files is run the Xerces XML parser against it. So while your file can still be parsed, it is not valid according to XML specification.

    The first place I would look is download samples from Maven’s site of other projects and see what the XSD definition looks like for those maven.xml files. If none of the files have a defined schema in them, then you can actually turn OFF validation on this particular file from MyEclipse by opening the file properties, and selecting “Derived”, then right clicking on your project go to MyEclipse and “Remove all Error Markers”. Now this file will still be edited as it was, but you will no longer get validation errors.

    People have to do this too with XDoclet files because even though they have .xml endings, they are not valid XML.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: cvc-elt.1: Cannot find the declaration of element ‘project’

You must be logged in to post in the forum log in