[
http://jira.codehaus.org/browse/MEXEC-56?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=161014#action_161014
]
Reto Bachmann-Gmür edited comment on MEXEC-56 at 1/15/09 8:56 AM:
------------------------------------------------------------------
the default scope should be runtime! running an application seems like the
prototypical usage for the runtime scope -> created MEXEC-62
was (Author: rebach):
the default scope should be runtime! running an application seems like the
prototypical usage for the runtime scope
> If setting the classpathScope to runtime the project classpath is empty
> -----------------------------------------------------------------------
>
> Key: MEXEC-56
> URL: http://jira.codehaus.org/browse/MEXEC-56
> Project: Maven 2.x Exec Plugin
> Issue Type: Bug
> Components: exec
> Affects Versions: 1.1
> Environment: Maven 2.0.9, Netbeans 6.1, maven plugin 3.1.4
> Reporter: Mathias Arens
> Assignee: Milos Kleint
> Fix For: 1.1.1
>
>
> Hello,
> I would like to start my Swing GUI from Netbeans 6.1 with maven plugin 3.1.4.
> But my problem is that one dependency is in runtime scope.
> So, I set the classpathScope of the exec-maven-plugin to runtime. But then
> the 'Collected project classpath' is empty and I get a ClassNotFoundException
> for my main class. In my opinion this is a bug because the 'runtime' scope
> includes all dependencies from the 'compile' scope as well. So it should also
> contain the compiled project classes.
> I downloaded the source code and fixed the problem by setting the project
> classpath for the runtime scope in the
> AbstractExecMojo.collectProjectArtifactsAndClasspath(List artifacts, List
> theClasspathFiles) routine:
> {code}
> protected void collectProjectArtifactsAndClasspath(List artifacts, List
> theClasspathFiles) {
> if ("compile".equals(classpathScope)) {
> artifacts.addAll(project.getCompileArtifacts());
> theClasspathFiles.add(new
> File(project.getBuild().getOutputDirectory()));
> } else if ("test".equals(classpathScope)) {
> artifacts.addAll(project.getTestArtifacts());
> theClasspathFiles.add(new
> File(project.getBuild().getTestOutputDirectory()));
> theClasspathFiles.add(new
> File(project.getBuild().getOutputDirectory()));
> } else if ("runtime".equals(classpathScope)) {
> artifacts.addAll(project.getRuntimeArtifacts());
> theClasspathFiles.add(new
> File(project.getBuild().getOutputDirectory()));
> } else if ("system".equals(classpathScope)) {
> artifacts.addAll(project.getSystemArtifacts());
> } else {
> throw new IllegalStateException("Invalid classpath scope: " +
> classpathScope);
> }
> getLog().debug("Collected project artifacts " + artifacts);
> getLog().debug("Collected project classpath " + theClasspathFiles);
> }
> {code}
> I just added the
> {code}
> theClasspathFiles.add(new File(project.getBuild().getOutputDirectory()));
> {code}
> to the runtime - code block. Now it works fine. It would be great if this fix
> is included in future releases.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.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