Hello, I've now better & fully understood the root cause of the error message shown below (org.apache.maven.plugin.MojoExecutionException: yang-to-sources: Unable to parse yang files from .../src/main/yang Caused by: org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException: Imported module [...] was not found. [at META-INF/yang/....yang:15:4]):
This happens both when using yangide, but even without yangide at all but when attempting to configure M2E lifecycle-mapping <execute/>for yang-maven-plugin <action><execute/> (which I do not recommend, but some projects still have this; BTW will anyone ever merge https://git.opendaylight.org/gerrit/#/c/39043/ and https://git.opendaylight.org/gerrit/#/c/39041/ ?) .. .. AND when one open project a in the workspace refers to a YANG model from another project B in the workspace ("in-workspace cross-project *.yang references"), AND when that project B does NOT (yet) have src/main/yang listed as a source folder. In that case, yangide respectively yangtools' yang-maven-plugin called by M2E, cannot find the referenced YANG model in B, as it's not on the classpath as a dependency. (BTW: It does work, always, when project B is closed, because then A has a dependency to a /META-INF/yang/*.yang in a .m2/repository/**/*.jar; and that's fine.) What can be slightly confusing is that it only happens during initial setup. If you have yangide (does anyone? you soon will, through https://github.com/vorburger/opendaylight-eclipse-setup ...), then if angrily does an Update Maven Configuration on B, if you know the correct dependency tree, then src/main/yang at some point gets automatically added as a source folder, by org.opendaylight.yangide.m2e.yang's YangProjectConfigurator. Once that's set, then this problem doesn't occur anymore, and is difficult to reproduce (unless you manually re-remove the src/main/yang from Project B). But of course, this should just work nicely out of the box. The solution, I think, is to do https://git.opendaylight.org/gerrit/#/c/39275/ in mdsal, and https://git.opendaylight.org/gerrit/#/c/39277/ in controller. FYA: Will you merge all Gerrits mentioned in this email thread, to fix this problem? Tx, M. -- Michael Vorburger <[email protected]> | IRC: vorburger @freenode | G/Hangout: michael.vorburger | Skype: mike_vorburger | ~ = http://vorburger.ch On Wed, May 18, 2016 at 3:05 PM, Michael Vorburger <[email protected]> wrote: > Hello (please cross-post replies to other lists if appropriate), > > I'm finding that when importing e.g. openflowplugin in the (Eclipse) IDE, > using https://github.com/vorburger/opendaylight-eclipse-setup, then the > error copy/pasted below frequently appears in the Error Log (in Eclipse), > and leaves ugly red marks on the pom.xml. (In addition to just being > "ugly", any kind of error always make it hard to see real errors.) > > This is because M2E, the Eclipse plugin for Maven, is trying to run > the yang-maven-plugin in-IDE - because we (someone) told it to do so via an > an M2E lifecycle-mapping <execute/> in a pom.xml .. But this integration > appears to be broken, I'm not sure if it ever properly worked in the past, > does anyone know? > > I therefore would like to suggest, as it's broken anyway, to remove the > M2E lifecycle-mapping, as suggested in > https://git.opendaylight.org/gerrit/39043. In > https://github.com/vorburger/opendaylight-eclipse-setup, the workspace > wide lifecycle mapping for yang-maven-plugin is ignore. > > In the future, I'm hoping that I'll be able to bundle yangide in > opendaylight-eclipse-setup, and it will correctly configure code > generation, because it has an M2E extension which does the right thing > (hopefully; more soon). > > Unless anyone shouts that I'm totally not getting how everyone works, I > will propose removing the M2E lifecycle-mapping for yang-maven-plugin from > pom.xml of other projects as well in the future. > > On an unrelated note, please also note > https://git.opendaylight.org/gerrit/39041 .. I'm not sure how this could > ever have worked before. > > Regards, > Michael > > yang-to-sources: Unable to parse yang files from > /home/vorburger/dev/ODL/git/openflowplugin/applications/forwardingrules-manager/src/main/yang > (org.opendaylight.yangtools:yang-maven-plugin:1.0.0-SNAPSHOT:generate-sources:default:generate-sources) > > org.apache.maven.plugin.MojoExecutionException: yang-to-sources: Unable to > parse yang files from > /home/vorburger/dev/ODL/git/openflowplugin/applications/forwardingrules-manager/src/main/yang > at > org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.processYang(YangToSourcesProcessor.java:200) > at > org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.execute(YangToSourcesProcessor.java:93) > at > org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesMojo.execute(YangToSourcesMojo.java:116) > at > org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) > at > org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331) > at > org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362) > at > org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1) > at > org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) > at > org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) > at > org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360) > at > org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52) > at > org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137) > at > org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172) > at > org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1) > at > org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115) > at > org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) > at > org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) > at > org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105) > at > org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) > at > org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151) > at > org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99) > at > org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86) > at > org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200) > at > org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735) > at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) > at > org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206) > at > org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246) > at > org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:301) > at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) > at > org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304) > at > org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:360) > at > org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:383) > at > org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144) > at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235) > at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) > Caused by: > org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException: > Imported module [config] was not found. [at null:6:1] > at > org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException.throwIf(InferenceException.java:47) > at > org.opendaylight.yangtools.yang.parser.stmt.rfc6020.ImportStatementDefinition$1.prerequisiteFailed(ImportStatementDefinition.java:103) > at > org.opendaylight.yangtools.yang.parser.stmt.reactor.ModifierImpl.failModifier(ModifierImpl.java:91) > at > org.opendaylight.yangtools.yang.parser.stmt.reactor.SourceSpecificContext.failModifiers(SourceSpecificContext.java:292) > at > org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.addSourceExceptions(BuildGlobalContext.java:215) > at > org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.completePhaseActions(BuildGlobalContext.java:284) > at > org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.buildEffective(BuildGlobalContext.java:176) > at > org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor$BuildAction.buildEffective(CrossSourceStatementReactor.java:105) > at > org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor$BuildAction.buildEffective(CrossSourceStatementReactor.java:123) > at > org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.processYang(YangToSourcesProcessor.java:169) > ... 34 more > > > Tx, > M. > -- > Michael Vorburger <[email protected]> | IRC: vorburger @freenode | > G/Hangout: michael.vorburger | Skype: mike_vorburger | ~ = > http://vorburger.ch >
_______________________________________________ openflowplugin-dev mailing list [email protected] https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev
