Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352534 - Models cannot be read by reader: validation error for reader
Summary: Models cannot be read by reader: validation error for reader
Status: CLOSED FIXED
Alias: None
Product: Xtend
Classification: Tools
Component: Core (show other bugs)
Version: 2.2.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-20 02:59 EDT by Christian Dietrich CLA
Modified: 2017-10-31 11:25 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Dietrich CLA 2011-07-20 02:59:28 EDT
Build Identifier: 2.0.0 + fix for 352450

If i read a simple xtend2 file with a workflow using the Reader component,
this does not work if i use src as path for the reader:

0    [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - Problems running
workflow Test: Validation problems: 
1 error:
    Test.xtend - C:\ba_dev81\guidsl_ws_113xxxx\test\src\test\Test.xtend
        1: The declared package 'test' does not match the expected package
java.lang.RuntimeException: Problems running workflow Test: Validation
problems: 
1 error:
    Test.xtend - C:\ba_dev81\guidsl_ws_113xxxx\test\src\test\Test.xtend
        1: The declared package 'test' does not match the expected package
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:99)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:64)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:55)
    at
org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
    at
org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
Caused by: org.eclipse.emf.mwe.core.WorkflowInterruptedException: Validation
problems:

this is cause the validator expects the xtend files to be read from the bin directory.

so if i change the workflow to

Workflow {

    component = org.eclipse.xtext.mwe.Reader {
        path = "bin"
        uriFilter = org.eclipse.xtext.mwe.NameBasedFilter {
            extension = "xtend"
        }
        register = org.eclipse.xtext.xtend2.Xtend2StandaloneSetup {}
        loadResource = {
            slot = "model"
        }
    }

}

it does work.

i an standalone scdenario i'd expect to be the root of path to be the root of the uri to check against as default package.

Reproducible: Always
Comment 1 Holger Schill CLA 2011-07-20 06:47:23 EDT
The validation proves if the defined package is equal to a part of a normalized classpathURI. At Runtme the classpathURI points to the file in the bin folder and not to the one in the src folder. For that reason you should use the bin folder to read the xtend-Files. Then the validation does not fail. In the IDE the classpathURI points to the file in the src folder so we do not have this problem in the IDE.

If this solves your problem please let me know so that we can close this bug.
Comment 2 Christian Dietrich CLA 2011-07-20 06:50:26 EDT
Hi,

as said before: yes using the bin folder solves the problem,
but this is ugly since in a standalone build i'd have to copy
my xtend classes to the/a bin folder
just to workarround this problem.

~Christian
Comment 3 Karsten Thoms CLA 2011-07-20 11:21:34 EDT
I consider this also as ugly workaround. Usually the Xtend files are meant to be colocated in the source path along with Java files. In a Standalone environment this should work without the requirement to copy files before being able to compile them.
Comment 4 Stephan Herrmann CLA 2011-08-24 09:43:00 EDT
I just came across a variation of this problem: my project is configured
using Maven and I saw 
   "The declared package 'foo' does not match the expected package"
BECAUSE the xtend files were copied to target/classes.
Only the copy was flagged with the error (reporting errors against
derived files is strange anyway).

Copying happened because in my pom I had

  <build>
    <resources>
      <resource>
        <directory>${project.build.sourceDirectory}</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
  </build>

The problem was resolved by adding:

         <exclude>**/*.xtend</exclude>

OTOH, in my scenario the problem was not flagged by the MweReader but
within the IDE, I assume by the Xtend builder.

I hope this observation helps to find a solution that makes all 
components / builders happy.
Comment 5 Sven Efftinge CLA 2012-11-08 03:48:02 EST
I moved the mentioned validation to the UI-only validator.
Comment 6 Eclipse Webmaster CLA 2017-10-31 11:25:29 EDT
Requested via bug 522520.

-M.