[ https://jira.codehaus.org/browse/MWAS-61?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Javier Murciego closed MWAS-61. ------------------------------- Resolution: Duplicate Fix Version/s: 1.2 Is the same issue as MWAS-34 > ejbDeploy is broken (alternate fix) > ----------------------------------- > > Key: MWAS-61 > URL: https://jira.codehaus.org/browse/MWAS-61 > Project: Maven 2.x WebSphere 6 Plugin > Issue Type: Bug > Affects Versions: 1.1.1 > Environment: WAS60 > Apache Maven 2.2.1 (r801777; 2009-08-06 22:16:01+0300) > Java version: 1.6.0_17 > Default locale: fi_FI, platform encoding: Cp1252 > OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows" > Reporter: Arthur van der Knaap > Assignee: Javier Murciego > Fix For: 1.2 > > > ejbDeploy fails, when it copies the files to the generated classes directory. > I fixed it for the WAS60 installation on my system. Changed > EjbDeployMojo.execute to: > public void execute() throws MojoExecutionException, > MojoFailureException { > if > (!getMavenProject().getPackaging().equalsIgnoreCase("ejb")) { > throw new MojoExecutionException( > "Invalid packaging type, this plugin > can only be applied to ejb packaging type projects"); > } > super.execute(); > if (!getOutputJarFile().exists()) // TODO: Solve generically > - MWAS-14 - > > // why doesn't failOnError fail the > > // build and ws_ant return a > > // returncode != 0? > { > throw new MojoExecutionException("Deployment failed - > see previous errors"); > } > File[] workingDirectorySubdirs = > getWorkingDirectory().listFiles( > (java.io.FileFilter) > DirectoryFileFilter.DIRECTORY); > if (workingDirectorySubdirs.length != 1) { > throw new MojoExecutionException("Cannot find > workbench root under " > + > getWorkingDirectory().getAbsolutePath()); > } > File[] potentialRoots = workingDirectorySubdirs[0] > .listFiles((java.io.FileFilter) > DirectoryFileFilter.DIRECTORY); > if (potentialRoots.length > 2) { > throw new MojoExecutionException("Cannot find > workbench root under " > + > getWorkingDirectory().getAbsolutePath()); > } > File workBenchRoot = null; > for (int i = 0; i < potentialRoots.length; i++) { > workBenchRoot = potentialRoots[i]; > if (!workBenchRoot.getName().equals(".metadata")) { > break; > } > } > // copy sources > File generatedSources = new File(workBenchRoot, "ejbModule"); > try { > // Create a filter for ".java" files > IOFileFilter javaSuffixFilter = > FileFilterUtils.suffixFileFilter(".java"); > IOFileFilter javaFiles = > FileFilterUtils.andFileFilter(FileFileFilter.FILE, javaSuffixFilter); > FileFilter filter = > FileFilterUtils.orFileFilter(DirectoryFileFilter.DIRECTORY, javaFiles); > FileUtils.copyDirectory(generatedSources, > getGeneratedSourcesDirectory(), filter); > FileUtils.deleteDirectory(new > File(getGeneratedSourcesDirectory(), "META-INF")); > } catch (IOException e) { > throw new MojoExecutionException("Error copying > generated sources", e); > } > List compileSourceRoots = > getMavenProject().getCompileSourceRoots(); > > compileSourceRoots.add(getGeneratedSourcesDirectory().getPath()); > // copy generated classes > File generatedClasses = new File(workBenchRoot, "ejbModule"); > try { > // Create a filter for ".class" files > IOFileFilter classSuffixFilter = > FileFilterUtils.suffixFileFilter(".class"); > IOFileFilter classFiles = > FileFilterUtils.andFileFilter(FileFileFilter.FILE, classSuffixFilter); > FileFilter filter = > FileFilterUtils.orFileFilter(DirectoryFileFilter.DIRECTORY, classFiles); > FileUtils.copyDirectory(generatedClasses, > getGeneratedClassesDirectory(), filter); > Resource resource = new Resource(); > > resource.setDirectory(getGeneratedClassesDirectory().getPath()); > getMavenProject().getResources().add(resource); > } catch (IOException e) { > throw new MojoExecutionException("Error copying > generated classes", e); > } > getLog().info("ejbDeploy finished"); > } > PS: sorry for not knowing how to create patches, I still wanted to share this. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email