}
@Override
protected ScriptFactory newScriptFactory(Artifact artifact) throws MojoExecutionException {
try {
final GemScriptFactory factory =
artifact == null ?
new GemScriptFactory(this.logger,
this.classRealm,
null,
this.project.getTestClasspathElements(),
this.jrubyFork,
this.gemsConfig):
(JRUBY_CORE.equals(artifact.getArtifactId()) ?
new GemScriptFactory(this.logger,
this.classRealm,
artifact.getFile(),
resolveJRubyStdlibArtifact(artifact).getFile(),
this.project.getTestClasspathElements(),
this.jrubyFork,
this.gemsConfig) :
new GemScriptFactory(this.logger,
this.classRealm,
artifact.getFile(),
this.project.getTestClasspathElements(),
this.jrubyFork,
this.gemsConfig));
if(supportNative){
factory.addJvmArgs("-Djruby.home=" + setupNativeSupport().getAbsolutePath());
}
if(rubySourceDirectory != null && rubySourceDirectory.exists()){
if(jrubyVerbose){
getLog().info("add to ruby loadpath: " + rubySourceDirectory.getAbsolutePath());
}
// add it to the load path for all scripts using that factory
factory.addSwitch("-I", rubySourceDirectory.getAbsolutePath());
}
if( libDirectory != null && libDirectory.exists() ){
if(jrubyVerbose){
getLog().info("add to ruby loadpath: " + libDirectory.getAbsolutePath());
}
// add it to the load path for all scripts using that factory
factory.addSwitch("-I", libDirectory.getAbsolutePath());
}
return factory;
}
catch (final DependencyResolutionRequiredException e) {