icfnext / cq-component-maven-plugin

Other
22 stars 35 forks source link

ReflectionsException could not get type for name #16

Closed jedatu closed 9 years ago

jedatu commented 9 years ago

I am getting an error from the plugin as it tries to gather annotations during Scanning for Components step.

org.reflections.ReflectionsException: could not get type for name com.mynamespace.ComponentClassType
    at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:378)
    at org.reflections.ReflectionUtils.forNames(ReflectionUtils.java:387)
    at org.reflections.Reflections.getTypesAnnotatedWith(Reflections.java:351)
    at com.citytechinc.cq.component.maven.util.ComponentMojoUtil.getAllComponentAnnotations(ComponentMojoUtil.java:465)
    at com.citytechinc.cq.component.maven.ComponentMojo.execute(ComponentMojo.java:87)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

In my case, the ComponentClassType extends an abstract base class which extends the AbstractComponent. I am wondering if this is a known issue in org.reflections where Reflections.getSubTypesOf(Object.class) should be used rather than whatever is being used.

Are there any known workarounds?

jedatu commented 9 years ago

Turns out I was missing a dependency in my UI POM. Even though the annotations were on components in my core Java package, I needed all the component's Bedrock dependencies in the UI POM. In my case this was bedrock-api, bedrock-core and bedrock-ui.