|
14 | 14 | import java.util.ArrayList;
|
15 | 15 | import java.util.LinkedList;
|
16 | 16 | import java.util.List;
|
| 17 | +import java.util.Set; |
17 | 18 | import java.util.regex.Matcher;
|
18 | 19 |
|
19 | 20 | import org.apache.maven.artifact.Artifact;
|
|
43 | 44 | import com.capgemini.cobigen.textmerger.TextMergerPluginActivator;
|
44 | 45 | import com.capgemini.cobigen.xmlplugin.XmlPluginActivator;
|
45 | 46 | import com.google.common.collect.Lists;
|
| 47 | +import com.google.common.collect.Sets; |
46 | 48 |
|
47 | 49 | import freemarker.template.TemplateException;
|
48 | 50 |
|
49 | 51 | /**
|
50 | 52 | * CobiGen generation Mojo, which handles generation using a configuration folder/archive
|
51 | 53 | * @author mbrunnli (08.02.2015)
|
52 | 54 | */
|
53 |
| -@Mojo(name = "generate", requiresDependencyResolution = ResolutionScope.RUNTIME, requiresProject = true, |
54 |
| - defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyCollection = ResolutionScope.RUNTIME) |
| 55 | +@Mojo(name = "generate", requiresDependencyResolution = ResolutionScope.TEST, requiresProject = true, |
| 56 | + defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyCollection = ResolutionScope.TEST) |
55 | 57 | public class GenerateMojo extends AbstractMojo {
|
56 | 58 |
|
57 | 59 | static {
|
@@ -333,13 +335,16 @@ private void generateFromTemplates(CobiGen cobiGen, List<Object> inputs) throws
|
333 | 335 | * @author mbrunnli (11.02.2015)
|
334 | 336 | */
|
335 | 337 | private ClassLoader getProjectClassLoader() throws MojoFailureException {
|
336 |
| - List<String> classpathElements = null; |
| 338 | + Set<String> classpathElements = Sets.newHashSet(); |
337 | 339 | try {
|
338 |
| - classpathElements = project.getCompileClasspathElements(); |
| 340 | + classpathElements.addAll(project.getCompileClasspathElements()); |
| 341 | + classpathElements.addAll(project.getTestClasspathElements()); |
339 | 342 | List<URL> projectClasspathList = new ArrayList<>();
|
340 | 343 | for (String element : classpathElements) {
|
341 | 344 | try {
|
342 |
| - projectClasspathList.add(new File(element).toURI().toURL()); |
| 345 | + URL url = new File(element).toURI().toURL(); |
| 346 | + getLog().debug("Add Classpath-URL: " + url); |
| 347 | + projectClasspathList.add(url); |
343 | 348 | } catch (MalformedURLException e) {
|
344 | 349 | getLog().error(element + " is an invalid classpath element", e);
|
345 | 350 | throw new MojoFailureException(element + " is an invalid classpath element");
|
|
0 commit comments