You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by depstei2 <de...@umd.edu> on 2009/04/01 17:31:58 UTC

Re: Classloader issues with source files in an aggregate build

We got around this issue by using a hacked version of the gwt maven plugin
which uses classworlds and explicitly add any source jars with the scope of
source to the classpath. This is good if you are using gwt, if you are using
something else that needs source jars you might need to come up with
something different.

The patch to use classworlds is in comment #26 
http://code.google.com/p/gwt-maven/issues/detail?id=88#c26
http://code.google.com/p/gwt-maven/issues/detail?id=88#c26 

and then add this after line 131 of BuildClasspathUtil.java

        //Add sources that are in this project
        List<Dependency> dependencies = project.getDependencies();
        for(Dependency d:dependencies){
            if("sources".equals(d.getClassifier())){
               
                Artifact art =
mojo.getArtifactFactory().createArtifactWithClassifier(d.getGroupId(),d.getArtifactId(),
                        d.getVersion(), "jar", d.getClassifier());
                try {
                    mojo.getResolver().resolve(art, new ArrayList(),
mojo.getLocalRepository());
                } catch (ArtifactResolutionException e) {
                    e.printStackTrace();
                } catch (ArtifactNotFoundException e) {
                    e.printStackTrace();
                }
                items.add(art.getFile());
            }
        }

Good luck!


depstei2 wrote:
> 
> Hello, I am trying to use the GWT maven plugin which relies on java source
> files. My project works when I run mvn install from my gwt application
> module's pom.  The classloader correctly references the sibling module's
> jar and sources-jar from my local maven repository.  
> 
> When I run mvn install from the parent's pom, instead of the class loader
> looking for the sibling module's dependencies in my local maven
> repository, it is referencing the module's target/classes folder directly. 
> By doing this, my source files are not in target/classes and my gwt build
> fails.  
> 
> Is there any way to force maven to use the repository instead of local
> project folders? I do not want to have to manually copy the sources files
> into the output directory.
> 
> parent
>   |-gwt application
>   |  |-src/main/java/...
>   |  |-pom.xml
>   |-other source files (generates jar and sources-jar)
>   |  |-src/main/java/...
>   |  |-pom.xml
>   |-pom.xml
> 

-- 
View this message in context: http://www.nabble.com/Classloader-issues-with-source-files-in-an-aggregate-build-tp20343191p22829205.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org