Community
Participate
Working Groups
We are using the “Resolve Workspace Artifacts” run configuration option in our code generation process, in order to process the workspacestate.properties file. We need this because we want to generate the classes only for open projects (We cannot use the workbench state file from Eclipse, because this is updated only at closing of the workbench and not at opening/closing of a project). Because we are using this information at generation time, it can happen that the target folder doesn’t exist yet. This is where we had to patch the m2e plugin, because the output location is verified that it is not null and it exists. WorkspaceStateWriter: ====================================================================== Old code (outputLocation is null if the target folder does not exist): ====================================================================== IResource outputLocation = root.findMember(projectFacade.getOutputLocation()); if (!"pom".equals(artifact.getType()) && outputLocation != null && outputLocation.exists()) { String key = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getType() + ":" + artifact.getBaseVersion(); state.put(key, outputLocation.getLocation().toFile().getCanonicalPath()); } ====================================================================== New code: ====================================================================== IPath outputLocation = projectFacade.getOutputLocation(); if (outputLocation != null) { if (!"pom".equals(artifact.getType())) { String key = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getType() + ":" + artifact.getBaseVersion(); String outputFile = new File(root.getLocation().toFile().getCanonicalPath() + outputLocation).getCanonicalPath(); state.put(key, outputFile); } Could this be added as a feature in m2e?
To make sure I understand the usecase correctly, you launch your code generation code in a separate jvm and from that jvm you want to use workspacestate.properties to find opened workspace projects. Did I get this right? Also, does your code generation run in Maven runtime and use maven artifact resolution logic?
Closing old/stale bugreports.
Moved to https://github.com/eclipse-m2e/m2e-core/issues/