[471114] Use modelDirectory to fix launches
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/AbstractCompilerChain.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/AbstractCompilerChain.java
index 8cecc99..1bdaed2 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/AbstractCompilerChain.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/AbstractCompilerChain.java
@@ -28,7 +28,6 @@
 import org.eclipse.emf.ecore.EStructuralFeature.Setting;
 import org.eclipse.emf.ecore.resource.Resource;
 import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.URIConverter;
 import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
@@ -110,25 +109,7 @@
 
 		public @NonNull Class<? extends Transformer> execute(@NonNull URI txURI, @NonNull JavaResult javaResult) throws Exception {
 			JavaClasspath classpath = basicGetOption(CLASSPATH_KEY);
-			URIConverter uriConverter = compilerChain.getEnvironmentFactory().getResourceSet().getURIConverter();
-			assert uriConverter != null;
-			//			System.out.println("classPathProjectNames = " + classPathProjectNames);
-			// List<@NonNull String> classpathProjects;
-			/*	if (EcorePlugin.IS_ECLIPSE_RUNNING) {
-				URI classFileURI = compilerChain.basicGetOption(QVTrCompilerChain.CLASS_STEP, QVTrCompilerChain.URI_KEY);
-				assert classFileURI != null;
-				String classFilePath2 = classFileURI.toFileString();
-				assert classFilePath2 != null;
-				URI traceURI = compilerChain.getURI(QVTrCompilerChain.TRACE_STEP, QVTrCompilerChain.URI_KEY);
-				String binProjectName = QVTr2QVTc.getProjectName(traceURI);
-				classpathProjects = CompilerUtil.createClassPathProjectList(uriConverter, binProjectName, classFilePath2, classPathProjectNames);
-			}
-			else {
-				classpathProjects = classpath;
-			} */
-			//			URI platformURI = URI.createPlatformResourceURI(compilerChain.get, true);
-			//			URI pathURI = environmentFactory.getResourceSet().getURIConverter().normalize(platformURI);
-			//			System.out.println("classpathProjects = " + classpathProjects);
+			assert classpath != null;
 			JavaFileObject compilationUnit = new OCL2JavaFileObject(javaResult.qualifiedClassName, javaResult.code);
 			List<@NonNull JavaFileObject> compilationUnits = Collections.singletonList(compilationUnit);
 			String problemMessage = JavaFileUtil.compileClasses(compilationUnits, javaResult.qualifiedClassName, javaResult.classPath, classpath);
@@ -137,7 +118,6 @@
 			}
 			File classFilePath = new File(javaResult.classPath);
 			List<@NonNull String> packagePaths = JavaFileUtil.gatherPackageNames(classFilePath, null);
-			//			Class<? extends Transformer> txClass = (Class<? extends Transformer>) JavaSourceFileObject.loadExplicitClass(explicitClassPath, qualifiedClassName.toString());
 			ClassLoader testClassLoader = compilerChain.getClass().getClassLoader();
 			ExplicitClassLoader classLoader = new ExplicitClassLoader(classFilePath, packagePaths, testClassLoader);
 			@SuppressWarnings("unchecked")
@@ -526,6 +506,27 @@
 		return environmentFactory;
 	}
 
+	/*	@Override
+	public @Nullable File getTraceClassesFolder() {
+		String classFilePath;
+		URI traceURI = getURI(QVTrCompilerChain.TRACE_STEP, QVTrCompilerChain.URI_KEY);
+		String binProjectName = QVTr2QVTc.getProjectName(traceURI);
+		if (EcorePlugin.IS_ECLIPSE_RUNNING) {
+			IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+			IProject binProject = root.getProject(binProjectName);
+			IFolder binFolder = binProject.getFolder(JavaFileUtil.TEST_BIN_FOLDER_NAME);
+			File binFile = URIUtil.toFile(binFolder.getLocationURI());
+			classFilePath = binFile.toString()/*.replace(".", "/")* /.replace("\\", "/");		// FIXME deduce/parameterize bin
+		}
+		else {
+			URI classFileURI = basicGetOption(QVTrCompilerChain.CLASS_STEP, QVTrCompilerChain.URI_KEY);
+			if (classFileURI != null) {
+				classFilePath = classFileURI.toFileString();
+			}
+		}
+		return null;
+	} */
+
 	@Override
 	public @NonNull URI getURI(@NonNull String stepKey, CompilerOptions.@NonNull Key<URI> uriKey) {
 		URI uri = basicGetOption(stepKey, URI_KEY);
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/CompilerChain.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/CompilerChain.java
index f0d1943..1f42a49 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/CompilerChain.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/CompilerChain.java
@@ -87,6 +87,7 @@
 	@NonNull Resource createResource(@NonNull URI uri) throws IOException;
 	void dispose();
 	@NonNull QVTbaseEnvironmentFactory getEnvironmentFactory();
+	//	@Nullable File getTraceClassesFolder();
 	@NonNull URI getURI(@NonNull String stepKey, CompilerOptions.@NonNull Key<URI> uriKey);
 	void removeListener(@NonNull Listener listener);
 	void saveResource(@NonNull Resource asResource, @NonNull String stepKey) throws IOException;
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/DefaultCompilerOptions.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/DefaultCompilerOptions.java
index 48504b1..6d1fa35 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/DefaultCompilerOptions.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/DefaultCompilerOptions.java
@@ -10,21 +10,30 @@
  ******************************************************************************/
 package org.eclipse.qvtd.compiler;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
+import org.eclipse.emf.common.EMFPlugin;
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.xmi.XMLResource;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.ocl.examples.codegen.dynamic.JavaClasspath;
+import org.eclipse.ocl.examples.codegen.dynamic.JavaFileUtil;
 import org.eclipse.ocl.pivot.resource.ASResource;
 import org.eclipse.ocl.pivot.utilities.URIUtil;
 import org.eclipse.qvtd.compiler.internal.utilities.CompilerUtil;
+import org.osgi.framework.Bundle;
 
 /**
  * The DefaultCompilerOptions provides the standard configuration of the CompilerChain.
@@ -48,6 +57,42 @@
 		setOption(CompilerChain.DEFAULT_STEP, CompilerChain.SAVE_OPTIONS_KEY, getSaveOptions());
 	}
 
+	private static File getProjectFolder(@NonNull String projectName) throws IOException {
+		assert EMFPlugin.IS_ECLIPSE_RUNNING;		// used by launch
+		IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+		IResource project = workspaceRoot.findMember(projectName);
+		if (project != null) {
+			String location = String.valueOf(project.getLocation());
+			File projectFile = new File(location);
+			File outputClassPath = JavaFileUtil.getOutputClassPath(projectFile);
+			if (outputClassPath != null) {
+				return outputClassPath;
+			}
+		}
+		//	String path = null;
+		Bundle bundle = Platform.getBundle(projectName);
+		if (bundle != null) {
+			try {
+				File bundleFile = FileLocator.getBundleFile(bundle);
+				if (bundleFile.isDirectory()) {
+					//	File outputPath = getOutputClassPath(bundleFile);
+					//	if (outputPath != null) {
+					//		addFile(outputPath);
+					//	}
+				}
+
+				//	File bundleFilePath = getOSGIClassPath(bundle);
+				//	location = bundle.getLocation();
+				//	path = bundleFilePath.toString();
+			} catch (IOException e) {
+				// Doesn't fail for sensible names.
+			}
+		}
+		//	if (path == null) {					// platform:/resource
+		//	}
+		return null;
+	}
+
 	public @NonNull Map<Object, Object> getSaveOptions() {
 		Map<Object, Object> saveOptions = new HashMap<Object, Object>(defaultSavingOptions);
 		saveOptions.put(ASResource.OPTION_NORMALIZE_CONTENTS, Boolean.TRUE);
@@ -55,8 +100,12 @@
 	}
 
 	private void setClassStepOptions(@NonNull String projectName, @NonNull URI classURI) throws IOException {
+		assert EMFPlugin.IS_ECLIPSE_RUNNING;		// used by launch
 		JavaClasspath classpath = CompilerUtil.createDefaultQVTiClasspath();
-		//	classpath.add(projectName); -- only used for QVTd launches -- ?? OSGI only ?? -- ?? project will be added later ??
+		File projectFolder = getProjectFolder(projectName);
+		if (projectFolder != null) {
+			classpath.addFile(projectFolder);
+		}
 		setOption(CompilerChain.CLASS_STEP, CompilerChain.CLASSPATH_KEY, classpath);
 		IFile classFiles = URIUtil.getResolvedFile(classURI);
 		if (classFiles != null) {
@@ -97,6 +146,7 @@
 
 	public void setQVTcGenerateOptions(@NonNull String projectName, @NonNull URI txURI,
 			@NonNull URI genModelURI, @NonNull URI javaURI, @NonNull URI classURI) throws IOException {
+		assert EMFPlugin.IS_ECLIPSE_RUNNING;		// used by launch
 		setOption(CompilerChain.GENMODEL_STEP, CompilerChain.URI_KEY, genModelURI);
 		IFile javaFiles = URIUtil.getResolvedFile(javaURI);
 		if (javaFiles != null) {
@@ -110,7 +160,9 @@
 
 	public void setQVTrGenerateOptions(@NonNull String projectName, @NonNull URI txURI,
 			@NonNull URI genModelURI, @NonNull URI javaURI, @NonNull URI classURI) throws IOException {
+		assert EMFPlugin.IS_ECLIPSE_RUNNING;		// used by launch
 		setOption(CompilerChain.GENMODEL_STEP, CompilerChain.URI_KEY, genModelURI);
+		setOption(CompilerChain.GENMODEL_STEP, CompilerChain.GENMODEL_MODEL_DIRECTORY_KEY, javaURI.toPlatformString(false));
 		String copyright = null; // "Copyright (c) 2015, 2016 Willink Transformations and others.\n;All rights reserved. This program and the accompanying materials\n;are made available under the terms of the Eclipse Public License v2.0\n;which accompanies this distribution, and is available at\n;http://www.eclipse.org/legal/epl-v20.html\n;\n;Contributors:\n;  E.D.Willink - Initial API and implementation");
 		String basePrefix = projectName;
 		Collection<@NonNull GenPackage> usedGenPackages = null;
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/GenModelGenerateCompilerStep.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/GenModelGenerateCompilerStep.java
index 3b94272..83d089d 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/GenModelGenerateCompilerStep.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/GenModelGenerateCompilerStep.java
@@ -21,8 +21,6 @@
 import javax.tools.JavaFileObject;
 
 import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.Path;
@@ -37,11 +35,11 @@
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.plugin.EcorePlugin;
 import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.ocl.examples.codegen.dynamic.JavaClasspath;
 import org.eclipse.ocl.examples.codegen.dynamic.JavaFileUtil;
 import org.eclipse.ocl.examples.codegen.genmodel.OCLGenModelUtil;
-import org.eclipse.qvtd.compiler.internal.qvtr2qvtc.QVTr2QVTc;
 
 /**
  * GenModelCompilerStep activates the EMF GenModel tooling to generate the Java classes from the
@@ -97,47 +95,31 @@
 	public void execute() throws IOException {
 		Boolean keepOldJavaFiles = compilerChain.basicGetOption(QVTrCompilerChain.GENMODEL_STEP, QVTrCompilerChain.KEEP_OLD_JAVA_FILES_KEY);
 		URI genmodelURI = compilerChain.getURI(QVTrCompilerChain.GENMODEL_STEP, QVTrCompilerChain.URI_KEY);
-		Resource genmodelResource = environmentFactory.getResourceSet().getResource(genmodelURI, true);
+		ResourceSet resourceSet = environmentFactory.getResourceSet();
+		Resource genmodelResource = resourceSet.getResource(genmodelURI, true);
 		assert genmodelResource != null;
 		GenModel genModel = (GenModel) genmodelResource.getContents().get(0);
-		JavaClasspath classpath = compilerChain.basicGetOption(QVTrCompilerChain.CLASS_STEP, QVTrCompilerChain.CLASSPATH_KEY);
 		URI classFileURI = compilerChain.basicGetOption(QVTrCompilerChain.CLASS_STEP, QVTrCompilerChain.URI_KEY);
+		@SuppressWarnings("unused")
 		URI traceURI = compilerChain.getURI(QVTrCompilerChain.TRACE_STEP, QVTrCompilerChain.URI_KEY);
 		if (classFileURI != null) {
-			String binProjectName = QVTr2QVTc.getProjectName(traceURI);
-			//			File zbinFile;
-			String classFilePath;
+			String classFilePath = classFileURI.toFileString();
 			String sourceFilePathPrefix;
-			//	List<@NonNull String> classpathProjects;
 			if (EcorePlugin.IS_ECLIPSE_RUNNING) {
 				IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
-				IProject binProject = root.getProject(binProjectName);
-				IFolder binFolder = binProject.getFolder(JavaFileUtil.TEST_BIN_FOLDER_NAME);
-				File binFile = URIUtil.toFile(binFolder.getLocationURI());
-				classFilePath = binFile.toString()/*.replace(".", "/")*/.replace("\\", "/");		// FIXME deduce/parameterize bin
 				IFile genIFile = root.getFile(new Path(genModel.getModelDirectory()));
 				File genFile = URIUtil.toFile(genIFile.getLocationURI());
 				sourceFilePathPrefix = genFile.getAbsolutePath().replace("\\", "/");
-				//	if (classpath == null) {
-				//		classpath = CompilerUtil.createClasspathProjectNameList(binProjectName);
-				//	}
-				//	classpathProjects = null;//JavaFileUtil.createClassPathProjectList(environmentFactory.getResourceSet().getURIConverter(), classProjectNames);
 			}
 			else {
-				//				ResourceSet resourceSet = environmentFactory.getResourceSet();
-				//				URI normalizedClassURI = resourceSet.getURIConverter().normalize(classFileURI);
-				classFilePath = classFileURI.toFileString();
-				//				URI location = classFileURI;//ClassUtil.nonNullState(((StandaloneProjectMap)environmentFactory.getProjectManager()).getLocation(binProjectName));
-				//				binFile = new File(objectPath);
 				URI genModelDirectoryURI = URI.createPlatformResourceURI(genModel.getModelDirectory(), true);
-				sourceFilePathPrefix = environmentFactory.getResourceSet().getURIConverter().normalize(genModelDirectoryURI).toFileString() + "/";
-				//	classpathProjects = null;
+				sourceFilePathPrefix = resourceSet.getURIConverter().normalize(genModelDirectoryURI).toFileString() + "/";
 			}
 			assert classFilePath != null;
 			if (keepOldJavaFiles != Boolean.TRUE) {
 				for (GenPackage genPackage : genModel.getGenPackages()) {
 					String basePackage = genPackage.getBasePackage();
-					String sourcePath = sourceFilePathPrefix + (basePackage != null ? ("/" + basePackage.replace(".", "/")) : "");
+					String sourcePath = sourceFilePathPrefix + (basePackage != null ? ("/" + basePackage.replace(".", "/")) : "") + "/" + genPackage.getEcorePackage().getName();
 					JavaFileUtil.deleteJavaFiles(sourcePath);
 				}
 			}
@@ -147,12 +129,14 @@
 			Set<@NonNull String> basePackages = new HashSet<>();
 			for (GenPackage genPackage : genModel.getGenPackages()) {
 				String basePackage = genPackage.getBasePackage();
-				basePackage = basePackage != null ? ("/" + basePackage.replace(".", "/")) : "";
+				basePackage = (basePackage != null ? ("/" + basePackage.replace(".", "/")) : "") + "/" + genPackage.getEcorePackage().getName();
 				if (basePackages.add(basePackage)) {
 					String sourceFilePath = sourceFilePathPrefix + basePackage;
 					JavaFileUtil.gatherCompilationUnits(compilationUnits, new File(sourceFilePath));
 				}
 			}
+			JavaClasspath classpath = compilerChain.basicGetOption(QVTrCompilerChain.CLASS_STEP, QVTrCompilerChain.CLASSPATH_KEY);
+			assert classpath != null;
 			String problemMessage = JavaFileUtil.compileClasses(compilationUnits, sourceFilePathPrefix, classFilePath, classpath);
 			if (problemMessage != null) {
 				addProblem(new CompilerChainException(problemMessage));
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/QVTrCompilerChain.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/QVTrCompilerChain.java
index bcb0bb5..8ebbee2 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/QVTrCompilerChain.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/QVTrCompilerChain.java
@@ -55,6 +55,7 @@
 import org.eclipse.qvtd.compiler.internal.qvtr2qvtc.QVTr2QVTc.GenPackageComparator;
 import org.eclipse.qvtd.compiler.internal.qvtr2qvts.QVTr2QVTs;
 import org.eclipse.qvtd.compiler.internal.qvts2qvts.QVTs2QVTs;
+import org.eclipse.qvtd.compiler.internal.utilities.CompilerUtil;
 import org.eclipse.qvtd.pivot.qvtbase.Transformation;
 import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseEnvironmentFactory.CreateStrategy;
 import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
@@ -64,6 +65,7 @@
 import org.eclipse.qvtd.pivot.qvtrelation.utilities.QVTrelationUtil;
 import org.eclipse.qvtd.pivot.qvtschedule.MappingRegion;
 import org.eclipse.qvtd.pivot.qvtschedule.RootRegion;
+import org.eclipse.qvtd.runtime.evaluation.AbstractTransformer;
 import org.eclipse.qvtd.runtime.evaluation.Transformer;
 
 /**
@@ -176,15 +178,21 @@
 				//
 				//	Create and Save GenModel
 				//
+				String genModelDirectory = compilerChain.basicGetOption(GENMODEL_STEP, GENMODEL_MODEL_DIRECTORY_KEY);
 				URI genModelURI = compilerChain.getURI(GENMODEL_STEP, URI_KEY);
 				saveOptions = compilerChain.basicGetOption(GENMODEL_STEP, SAVE_OPTIONS_KEY);
 				if (saveOptions == null) {
 					saveOptions = XMIUtil.createSaveOptions();
 				}
 				saveOptions.put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
-				Collection<@NonNull ? extends GenPackage> usedGenPackages = compilerChain.basicGetOption(GENMODEL_STEP, GENMODEL_USED_GENPACKAGES_KEY);
-				saveGenModel(this, traceResource, genModelURI, compilerChain.basicGetOption(GENMODEL_STEP, GENMODEL_OPTIONS_KEY), saveOptions, usedGenPackages);
-				//					>>>>>>> fd5dac8 [529130] Change to QVTr-to-QVTs+trace in CompilerChain
+				Set<@NonNull GenPackage> usedGenPackages = new HashSet<>();
+				GenPackage traceGenPackage = CompilerUtil.getGenPackage(environmentFactory.getResourceSet(), AbstractTransformer.TRACE_GENMODEL, AbstractTransformer.TRACE_GENMODEL_FRAGMENT);
+				usedGenPackages.add(traceGenPackage);
+				Collection<@NonNull ? extends GenPackage> moreUsedGenPackages = compilerChain.basicGetOption(GENMODEL_STEP, GENMODEL_USED_GENPACKAGES_KEY);
+				if (moreUsedGenPackages != null) {
+					usedGenPackages.addAll(moreUsedGenPackages);
+				}
+				saveGenModel(this, traceResource, genModelURI, compilerChain.basicGetOption(GENMODEL_STEP, GENMODEL_OPTIONS_KEY), genModelDirectory, saveOptions, usedGenPackages);
 			}
 			finally {
 				environmentFactory.setCreateStrategy(savedStrategy);
@@ -223,7 +231,7 @@
 			}
 		}
 
-		public @NonNull GenModel saveGenModel(@NonNull ProblemHandler problemHandler, @NonNull Resource asResource, @NonNull URI genModelURI, @Nullable Map<@NonNull String, @Nullable String> genModelOptions, @NonNull Map<Object, Object> saveOptions2, @Nullable Collection<@NonNull ? extends GenPackage> usedGenPackages) throws IOException {
+		public @NonNull GenModel saveGenModel(@NonNull ProblemHandler problemHandler, @NonNull Resource asResource, @NonNull URI genModelURI, @Nullable Map<@NonNull String, @Nullable String> genModelOptions, @Nullable String genModelDirectory, @NonNull Map<Object, Object> saveOptions2, @Nullable Collection<@NonNull ? extends GenPackage> usedGenPackages) throws IOException {
 			URI traceURI = asResource.getURI();
 			assert traceURI != null;
 			@NonNull URI ecoreURI = PivotUtilInternal.getNonASURI(traceURI);
@@ -244,7 +252,12 @@
 				Collections.sort(allUsedGenPackages, GenPackageComparator.INSTANCE);
 				genModel.getUsedGenPackages().addAll(allUsedGenPackages);
 			}
-			genModel.setModelDirectory("/" + projectName + "/" + JavaFileUtil.TEST_SRC_FOLDER_NAME);
+			if (genModelDirectory != null) {
+				genModel.setModelDirectory(genModelDirectory);
+			}
+			else {
+				genModel.setModelDirectory("/" + projectName + "/" + JavaFileUtil.TEST_SRC_FOLDER_NAME);
+			}
 			genModel.setModelPluginID(projectName);
 			genModel.setModelName(trimFileExtension.lastSegment());
 			genModel.setBundleManifest(false);
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/utilities/CompilerUtil.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/utilities/CompilerUtil.java
index 4497448..5c4535c 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/utilities/CompilerUtil.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/utilities/CompilerUtil.java
@@ -11,6 +11,8 @@
 package org.eclipse.qvtd.compiler.internal.utilities;
 
 import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -20,9 +22,11 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
 import org.eclipse.emf.common.util.Diagnostic;
 import org.eclipse.emf.common.util.ECollections;
 import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EReference;
 import org.eclipse.emf.ecore.EStructuralFeature.Setting;
@@ -45,6 +49,7 @@
 import org.eclipse.ocl.pivot.Variable;
 import org.eclipse.ocl.pivot.VariableExp;
 import org.eclipse.ocl.pivot.ids.OperationId;
+import org.eclipse.ocl.pivot.utilities.ClassUtil;
 import org.eclipse.ocl.pivot.utilities.LabelUtil;
 import org.eclipse.ocl.pivot.utilities.NameUtil;
 import org.eclipse.ocl.pivot.utilities.Nameable;
@@ -109,6 +114,17 @@
 		@NonNull Iterable<@NonNull PR> getProducers();
 	}
 
+	/**
+	 * Add the URI to the list of classpath elememnts.
+	 *
+	 * @throws MalformedURLException
+	 */
+	@Deprecated /* Promote to JavaClasspath */
+	public static void addURI(@NonNull JavaClasspath classpath, @NonNull URI uri) throws MalformedURLException {
+		classpath.addURL(new URL(uri.isFile() ? uri.toString() : uri.toFileString()));
+	}
+
+
 	public static void assertNoResourceErrors(@NonNull String prefix, @NonNull Resource resource) {
 		String message = PivotUtil.formatResourceDiagnostics(resource.getErrors(), prefix, "\n\t");
 		if (message != null)
@@ -507,6 +523,14 @@
 		return allPartitionAnalyses;
 	}
 
+	public static @NonNull GenPackage getGenPackage(@NonNull ResourceSet resourceSet, @NonNull String resourcePath, @Nullable String fragment) {
+		URI uri = URI.createPlatformResourceURI(resourcePath, false);
+		if (fragment != null) {
+			uri = uri.appendFragment(fragment);
+		}
+		return ClassUtil.nonNullState((GenPackage)resourceSet.getEObject(uri, true));
+	}
+
 	public static void indent(@NonNull StringBuilder s, int depth) {
 		for (int i = 0; i < depth; i++) {
 			s.append("    ");
diff --git a/tests/org.eclipse.qvtd.xtext.qvtbase.tests/src/org/eclipse/qvtd/xtext/qvtbase/tests/AbstractTestQVT.java b/tests/org.eclipse.qvtd.xtext.qvtbase.tests/src/org/eclipse/qvtd/xtext/qvtbase/tests/AbstractTestQVT.java
index 1ed16b6..b314b62 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtbase.tests/src/org/eclipse/qvtd/xtext/qvtbase/tests/AbstractTestQVT.java
+++ b/tests/org.eclipse.qvtd.xtext.qvtbase.tests/src/org/eclipse/qvtd/xtext/qvtbase/tests/AbstractTestQVT.java
@@ -72,7 +72,6 @@
 import org.eclipse.qvtd.pivot.qvtschedule.ScheduleModel;
 import org.eclipse.qvtd.pivot.qvtschedule.RootRegion;
 import org.eclipse.qvtd.pivot.qvtschedule.utilities.QVTscheduleUtil;
-import org.eclipse.qvtd.runtime.evaluation.AbstractTransformer;
 import org.eclipse.qvtd.runtime.evaluation.Transformer;
 import org.eclipse.qvtd.xtext.qvtimperativecs.QVTimperativeCSPackage;
 import org.eclipse.xtext.resource.XtextResource;
@@ -189,8 +188,6 @@
 		URI ecoreURI = URI.createURI(EcorePackage.eNS_URI);
 		getProjectManager().getPackageDescriptor(ecoreURI).configure(getResourceSet(), StandaloneProjectMap.LoadFirstStrategy.INSTANCE,
 			StandaloneProjectMap.MapToFirstConflictHandler.INSTANCE);
-
-		addUsedGenPackage(AbstractTransformer.TRACE_GENMODEL, AbstractTransformer.TRACE_GENMODEL_FRAGMENT);
 	}
 
 	public void addClasspathClass(@NonNull Class<?> classpathClass) {
@@ -208,11 +205,7 @@
 		if (usedGenPackages == null) {
 			usedGenPackages = new ArrayList<>();
 		}
-		URI uri = URI.createPlatformResourceURI(resourcePath, false);
-		if (fragment != null) {
-			uri = uri.appendFragment(fragment);
-		}
-		GenPackage genPackage = ClassUtil.nonNullState((GenPackage)getResourceSet().getEObject(uri, true));
+		GenPackage genPackage = CompilerUtil.getGenPackage(getResourceSet(), resourcePath, fragment);
 		usedGenPackages.add(genPackage);
 		return genPackage;
 	}