| File |
Line |
| org\codehaus\mojo\gwt\shell\TestMojo.java |
212 |
| org\codehaus\mojo\gwt\test\TestMojo.java |
237 |
}
/**
* @return the project classloader
* @throws DependencyResolutionRequiredException failed to resolve project dependencies
* @throws MalformedURLException configuration issue ?
*/
protected ClassLoader getProjectClassLoader()
throws DependencyResolutionRequiredException, MalformedURLException
{
getLog().debug( "AbstractMojo#getProjectClassLoader()" );
List<?> compile = getProject().getCompileClasspathElements();
URL[] urls = new URL[compile.size()];
int i = 0;
for ( Object object : compile )
{
if ( object instanceof Artifact )
{
urls[i] = ( (Artifact) object ).getFile().toURI().toURL();
}
else
{
urls[i] = new File( (String) object ).toURI().toURL();
}
i++;
}
return new URLClassLoader( urls, ClassLoader.getSystemClassLoader() );
}
/**
* @param path file to add to the project compile directories
*/
protected void addCompileSourceRoot( File path )
{
getProject().addCompileSourceRoot( path.getAbsolutePath() );
}
/**
* Add project classpath element to a classpath URL set
*
* @param originalUrls the initial URL set
* @return full classpath URL set
* @throws MojoExecutionException some error occured
*/
protected URL[] addProjectClasspathElements( URL[] originalUrls )
throws MojoExecutionException
{
Collection<?> sources = getProject().getCompileSourceRoots();
Collection<?> resources = getProject().getResources();
Collection<?> dependencies = getProject().getArtifacts();
URL[] urls = new URL[originalUrls.length + sources.size() + resources.size() + dependencies.size() + 2];
int i = originalUrls.length;
getLog().debug( "add compile source roots to GWTCompiler classpath " + sources.size() );
i = addClasspathElements( sources, urls, i );
getLog().debug( "add resources to GWTCompiler classpath " + resources.size() );
i = addClasspathElements( resources, urls, i );
getLog().debug( "add project dependencies to GWTCompiler classpath " + dependencies.size() );
i = addClasspathElements( dependencies, urls, i );
try
{
urls[i++] = getGenerateDirectory().toURL();
|
| File |
Line |
| org\codehaus\mojo\gwt\shell\TestMojo.java |
189 |
| org\codehaus\mojo\gwt\test\TestMojo.java |
214 |
private String getClassPathElementFor( Class < ? > clazz )
{
String classFile = clazz.getName().replace( '.', '/' ) + ".class";
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if ( cl == null )
{
cl = getClass().getClassLoader();
}
URL url = cl.getResource( classFile );
String path = url.toString();
if ( path.startsWith( "jar:" ) )
{
path = path.substring( 4, path.indexOf( "!" ) );
}
else
{
path = path.substring( 0, path.length() - classFile.length() );
}
if ( path.startsWith( "file:" ) )
{
path = path.substring( 5 );
}
return path;
|
| File |
Line |
| org\codehaus\mojo\gwt\GenerateAsyncMojo.java |
296 |
| org\codehaus\mojo\gwt\shell\TestMojo.java |
211 |
return new File( path );
}
/**
* @return the project classloader
* @throws DependencyResolutionRequiredException failed to resolve project dependencies
* @throws MalformedURLException configuration issue ?
*/
protected ClassLoader getProjectClassLoader()
throws DependencyResolutionRequiredException, MalformedURLException
{
getLog().debug( "AbstractMojo#getProjectClassLoader()" );
List<?> compile = getProject().getCompileClasspathElements();
URL[] urls = new URL[compile.size()];
int i = 0;
for ( Object object : compile )
{
if ( object instanceof Artifact )
{
urls[i] = ( (Artifact) object ).getFile().toURI().toURL();
}
else
{
urls[i] = new File( (String) object ).toURI().toURL();
}
i++;
}
return new URLClassLoader( urls, ClassLoader.getSystemClassLoader() );
}
|
| File |
Line |
| org\codehaus\mojo\gwt\GenerateAsyncMojo.java |
297 |
| org\codehaus\mojo\gwt\test\TestMojo.java |
237 |
}
/**
* @return the project classloader
* @throws DependencyResolutionRequiredException failed to resolve project dependencies
* @throws MalformedURLException configuration issue ?
*/
protected ClassLoader getProjectClassLoader()
throws DependencyResolutionRequiredException, MalformedURLException
{
getLog().debug( "AbstractMojo#getProjectClassLoader()" );
List<?> compile = getProject().getCompileClasspathElements();
URL[] urls = new URL[compile.size()];
int i = 0;
for ( Object object : compile )
{
if ( object instanceof Artifact )
{
urls[i] = ( (Artifact) object ).getFile().toURI().toURL();
}
else
{
urls[i] = new File( (String) object ).toURI().toURL();
}
i++;
}
return new URLClassLoader( urls, ClassLoader.getSystemClassLoader() );
}
|