<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:08:57 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>OpenDaylight JIRA</title>
    <link>https://jira.opendaylight.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>8.20.10</version>
        <build-number>820010</build-number>
        <build-date>22-06-2022</build-date>
    </build-info>


<item>
            <title>[MDSAL-190] AbstractDataBrokerTest put of DataObject with Augmentation causing a NPE due to BindingRuntimeContext.getTypeWithSchema null</title>
                <link>https://jira.opendaylight.org/browse/MDSAL-190</link>
                <project id="10137" key="MDSAL">mdsal</project>
                    <description>&lt;p&gt;When you try to put of DataObject (Interface) with an Augmentation (InterfaceAcl) into a DataBroker in an AbstractDataBrokerTest, then in org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext.getTypeWithSchema(Type) the lookup in that BiMap&amp;lt;Type, Object&amp;gt; typeToDefiningSchema is empty for that Type referencedType (the Augment) ... and you get an NPE or a message such as &quot;java.lang.NullPointerException: Failed to find schema for type ReferencedTypeImpl &lt;span class=&quot;error&quot;&gt;&amp;#91;packageName=org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608, name=InterfaceAcl&amp;#93;&lt;/span&gt;&quot; with &lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/42296/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/42296/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I&apos;ll post a Gerrit with a reproducer for this problem in a second.&lt;/p&gt;</description>
                <environment>&lt;p&gt;Operating System: All&lt;br/&gt;
Platform: All&lt;/p&gt;</environment>
        <key id="27012">MDSAL-190</key>
            <summary>AbstractDataBrokerTest put of DataObject with Augmentation causing a NPE due to BindingRuntimeContext.getTypeWithSchema null</summary>
                <type id="10104" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</type>
                                                <status id="5" iconUrl="https://jira.opendaylight.org/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10000">Done</resolution>
                                        <assignee username="vorburger">Michael Vorburger</assignee>
                                    <reporter username="vorburger">Michael Vorburger</reporter>
                        <labels>
                    </labels>
                <created>Fri, 22 Jul 2016 10:56:25 +0000</created>
                <updated>Fri, 9 Mar 2018 18:00:16 +0000</updated>
                            <resolved>Wed, 10 Aug 2016 09:25:26 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="54407" author="vorburger" created="Fri, 22 Jul 2016 11:01:59 +0000"  >&lt;p&gt;Attachment bug6252-stacktrace.txt has been added with description: Full stack trace attached, for future Googling.&lt;/p&gt;</comment>
                            <comment id="54392" author="vorburger" created="Fri, 22 Jul 2016 11:02:26 +0000"  >&lt;p&gt;&amp;gt; I&apos;ll post a Gerrit with a reproducer for this problem in a second.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://git.opendaylight.org/gerrit/42302&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/42302&lt;/a&gt; reproduces this problem easily.&lt;/p&gt;</comment>
                            <comment id="54393" author="filip.gregor@pantheon.tech" created="Mon, 25 Jul 2016 10:29:09 +0000"  >&lt;p&gt;Hi, i have looked into your test and the problem seems to be missing plugin in pom file. After the change all tests passed&lt;/p&gt;</comment>
                            <comment id="54394" author="vorburger" created="Mon, 25 Jul 2016 13:35:05 +0000"  >&lt;p&gt;&amp;gt; i have looked into your test and &lt;/p&gt;

&lt;p&gt;Thank you!&lt;/p&gt;

&lt;p&gt;&amp;gt; the problem seems to be missing plugin in pom file. &lt;/p&gt;

&lt;p&gt;Ah yes I forgot xtend-maven-plugin, saw that you added that to gerrit/#/c/42296 - tx.&lt;/p&gt;

&lt;p&gt;FYI I actually never ran the CLI mvn test, and had this problem in  IDE... (The original project where I ran into this did have the xtend-maven-plugin, I just forgot it in the isolated branch created to reproduce the problem.)&lt;/p&gt;

&lt;p&gt;&amp;gt; After the change all tests passed&lt;/p&gt;

&lt;p&gt;... and that, IDE vs CLI, is the crux here - it indeed works on &quot;mvn test&quot; (always did), but there&apos;s something foul in-IDE (Eclipse, with &lt;a href=&quot;https://github.com/vorburger/opendaylight-eclipse-setup&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/vorburger/opendaylight-eclipse-setup&lt;/a&gt;) ... hm, interesting:&lt;/p&gt;

&lt;p&gt;At first, when I re-ran the BugReproducerTest in-IDE, after having done a &quot;mvn test&quot; on CLI, and it DL&apos;d new JARs from &lt;a href=&quot;http://nexus.opendaylight.org&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://nexus.opendaylight.org&lt;/a&gt;, it was green in the IDE as well.&lt;/p&gt;

&lt;p&gt;Then I started to doing some &quot;mvn clean&quot; in the aclservice/impl &amp;amp; aclservice/api (which is where that InterfaceAcl augmentation that is not found is in....) and then I could reproduce the NPE again when running the BugReproducerTest in-IDE!&lt;/p&gt;

&lt;p&gt;Either it&apos;s something weird to do with Xtend, but I think that&apos;s unlikely. (I could try to get Xtend out of the picture first, just to be sure.)&lt;/p&gt;

&lt;p&gt;Most likely, I suspect that something is different / missing on the classpath between Maven (surefire) and when run inside the IDE. I actually have a suspicion that I&apos;ll investigate further now: Vaguely understand that AbstractDataBrokerTest extends AbstractSchemaAwareTest, which in BindingReflections uses ServiceLoader.load(YangModelBindingProvider.class) which is based on finding stuff via /META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider - right? And THAT is broken, sometimes, somehow, in-IDE!&lt;/p&gt;

&lt;p&gt;BTW: Do you agree that whatever we come up with, it should never blow up with an NPE like this, and at the very least we should make sure that we harden that code?&lt;/p&gt;</comment>
                            <comment id="54395" author="vorburger" created="Mon, 25 Jul 2016 14:34:35 +0000"  >&lt;p&gt;Right, so if I CLOSE the aclservice-api project in Eclipse, then the BugReproducerTest is GREEN. The api JAR on the CP of course contains its META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider.&lt;/p&gt;

&lt;p&gt;If I now &quot;mvn clean generate-sources&quot; the api project and re-open it in Eclipse and Project Clean it due to I think another unrelated problem, then BugReproducerTest is STILL GREEN.  And, while in api project, a find -name org.opendaylight.yangtools.yang.binding.YangModelBindingProvider yields:&lt;/p&gt;

&lt;p&gt;./target/classes/META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider&lt;br/&gt;
./target/generated-sources/spi/META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider&lt;/p&gt;

&lt;p&gt;so far so good.  Just to simulate, if I now rm ./target/classes/META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider, THEN this problem occurs (test is red; more easily reproduced faster with something like attached GetResourcesYangModelBindingProviderBugReproducerTest which checks how many META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider&quot; are on the classpath; should currently normally be 34, but is 33 when this problem occurs - because aclservice-api&apos;s is missing. And that is certainly the root of this problem.&lt;/p&gt;

&lt;p&gt;I&apos;m not sure yet why ./target/classes/META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider sometimes disappears, but clearly it does.&lt;/p&gt;

&lt;p&gt;Actually, I&apos;m not even clear what sometimes put it into ./target/classes/META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider in the first place.  The Code Generator probably puts it into ./target/generated-sources/spi/META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider? Exactly which one does that? It&apos;s a little curious that the effective pom.xml of e.g. aclservice-api doesn&apos;t have &quot;generated-sources/spi&quot; anywhere... looks like this is probably hard-coded somewhere?&lt;/p&gt;

&lt;p&gt;Coming to think of it.. here&apos;s something: Both the target/generated-sources/config-binding and target/generated-sources/mdsal-binding are &quot;source folders&quot; in the IDE - something configures this (possibly yangide, or an M2E extension), and that seems... reasonable - good.  However the target/generated-sources/spi currently is not a Source Folder, and that... I&apos;m not sure is right, and may well be the root cause of this problem? IFF something somewhere copies target/generated-sources/spi into target/classes, then it works - but it seems there are scenarios where it doesn&apos;t.  IFF target/generated-sources/spi also always was a source folder, then this &lt;del&gt;probably&lt;/del&gt; would never happen?&lt;/p&gt;


&lt;p&gt;Filip may I propose that we split working on this bug into two halves? The Eclipse classpath issue (me) and preventing the NPE and, if you like and think this is worthwhile, catching this problem earlier with a clearer message (you?).&lt;/p&gt;</comment>
                            <comment id="54408" author="vorburger" created="Mon, 25 Jul 2016 14:35:39 +0000"  >&lt;p&gt;Attachment GetResourcesYangModelBindingProviderBugReproducerTest.java has been added with description: GetResourcesYangModelBindingProviderBugReproducerTest.java&lt;/p&gt;</comment>
                            <comment id="54396" author="vorburger" created="Mon, 25 Jul 2016 15:34:23 +0000"  >&lt;p&gt;Right... OK seem to be a bit of a mess, probably historical, but anyway, so:&lt;/p&gt;

&lt;p&gt;If we close the Eclipse IDE or disable Project &amp;gt; Build automatically, to make sure that it doesn&apos;t interfere with the command line build experiments, we see that, being in aclservice/api:&lt;/p&gt;

&lt;p&gt;$ mvno clean generate-sources&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;INFO&amp;#93;&lt;/span&gt; yang-to-sources: Sources generated by org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl: [ (...) , /home/vorburger/dev/ODL/git/netvirt/vpnservice/aclservice/api/target/generated-sources/spi/META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider]&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;INFO&amp;#93;&lt;/span&gt; &amp;#8212; build-helper-maven-plugin:1.10:add-source (add-yang-sources) @ aclservice-api &amp;#8212;&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;INFO&amp;#93;&lt;/span&gt; Source directory: /home/vorburger/dev/ODL/git/netvirt/vpnservice/aclservice/api/src/main/yang added.&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;INFO&amp;#93;&lt;/span&gt; Source directory: /home/vorburger/dev/ODL/git/netvirt/vpnservice/aclservice/api/target/generated-sources/config-binding added.&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;INFO&amp;#93;&lt;/span&gt; Source directory: /home/vorburger/dev/ODL/git/netvirt/vpnservice/aclservice/api/target/generated-sources/mdsal-binding added.&lt;/p&gt;

&lt;p&gt;$ find -name org.opendaylight.yangtools.yang.binding.YangModelBindingProvider&lt;/p&gt;

&lt;p&gt;./target/generated-sources/spi/META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider&lt;/p&gt;

&lt;p&gt;This seems to come out of org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl (in mdsal&apos;s org.opendaylight.mdsal.maven-sal-api-gen-plugin project) which in writeMetaInfServices constructs outputBaseDir + META-INF/services ... I can&apos;t figure out what set outputBaseDir to be target/generated-sources/spi, because &quot;spi&quot; is nowhere in CodeGeneratorImpl, but be that as it may.&lt;/p&gt;

&lt;p&gt;With a &quot;mvn -X clean package&quot; we can see that it is the maven-resources-plugin which is &quot;Copying file META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider&quot; and then &quot;copy /home/vorburger/dev/ODL/git/netvirt/vpnservice/aclservice/api/target/generated-sources/spi/META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider to /home/vorburger/dev/ODL/git/netvirt/vpnservice/aclservice/api/target/classes/META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider&quot;&lt;/p&gt;

&lt;p&gt;This is because earlier something in the yang-maven-plugin (that&apos;s buried inside the org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.YangProvider.setResource) has caused:&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;DEBUG&amp;#93;&lt;/span&gt; yang-to-sources: Folder: /home/vorburger/dev/ODL/git/netvirt/vpnservice/aclservice/api/target/generated-sources/spi marked as resources for generator: org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl&lt;/p&gt;

&lt;p&gt;And so in a mvn CLI the META-INF/services ends up in the JAR (the maven-bundle-plugin which I think acts very similar to the maven-jar-plugin, bundles everything found in target/classes into the JAR archive).&lt;/p&gt;</comment>
                            <comment id="54397" author="vorburger" created="Mon, 25 Jul 2016 15:34:51 +0000"  >&lt;p&gt;Now that we understand and documented exactly how this is supposed to work and does work in CLI mvn, we can debug further why in-IDE (Eclipse) this, sometimes at least, the steps above do not seem to work accordingly in-IDE!&lt;/p&gt;

&lt;p&gt;We now note that the M2E lifescylce mapping for yang:generate-sources (config), which is where CodeGeneratorImpl is, is &quot;configuration&quot; from &quot;source&quot; extension - that&apos;s yangide!&lt;/p&gt;

&lt;p&gt;For &quot;resources:resources&quot; it&apos;s &quot;execute&quot; from source &quot;default&quot;. So long story short, normally the Eclipse IDE SHOULD do the same thing as the CLI mvn here... unless yangide screws this up?&lt;/p&gt;</comment>
                            <comment id="54398" author="vorburger" created="Mon, 25 Jul 2016 16:14:31 +0000"  >&lt;p&gt;Just noticed that the Problems (not Error Log) view just showed a PluginExecutionException: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:3.0.1:resources failed: Unable to load the mojo &apos;resources&apos; (or one of its required components) from the plugin &apos;org.apache.maven.plugins:maven-resources-plugin:3.0.1&apos; ... that&apos;s &lt;a href=&quot;https://bugs.eclipse.org/bugs/show_bug.cgi?id=496944&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://bugs.eclipse.org/bugs/show_bug.cgi?id=496944&lt;/a&gt; - and could well cause the target/generated-sources/spi/META-INF/services to not be copied to target/classes/META-INF/services and thus be causing this, sometimes.&lt;/p&gt;</comment>
                            <comment id="54399" author="vorburger" created="Mon, 25 Jul 2016 16:37:00 +0000"  >&lt;p&gt;&amp;gt; GetResourcesYangModelBindingProviderBugReproducerTest which checks how many META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider&quot; are on the classpath; should currently normally be 34, but is 33 when this problem occurs&lt;/p&gt;

&lt;p&gt;That test as-is is stupid of course, because now, when it&apos;s working, I somehow have 35, maybe some SNAPSHOT just &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.opendaylight.org/images/icons/emoticons/help_16.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; changed, so forget that as test for this condition. Instead it would better have to actually check if is one of the URLs from getResources() contains &quot;aclservice/api/target/classes/META-INF/services/org.opendaylight.yangtools.yang.binding.YangModelBindingProvider&quot; ..&lt;/p&gt;</comment>
                            <comment id="54400" author="vorburger" created="Mon, 25 Jul 2016 16:46:01 +0000"  >&lt;p&gt;Hm, so two final observations here, and then I think I&apos;ll &quot;pause&quot; this, and see how bad this problem really is when writing more tests, and then decide if and how to get back to this:&lt;/p&gt;

&lt;p&gt;A right-click Maven &amp;gt; Update Project (which includes Clean projects), usually, actually seems to &quot;solve&quot; this when it&apos;s stuck like this, and correctly copy the resource created by generate-sources. So... if you know that &quot;trick&quot;, this isn&apos;t that Critical, anymore.&lt;/p&gt;

&lt;p&gt;On at least one occasion, I saw it not working (NPE, missing from CP) but a FS find did show target/classes/META-INF/services was present.  So I have a feeling that Eclipse may actually be &quot;caching&quot; the contents of the project&apos;s classpath constructed from the target/classes output folder, and only reliably update it with changes made by Eclipse/Maven-through-M2E plugins, but not CLI mvn runs. Just a guess and note for future memory - this would need further testing.&lt;/p&gt;

&lt;p&gt;About the idea above to do a build-helper-maven-plugin:add-source for target/generated-sources/spi/, that&apos;s &quot;not neccessary in an ideal world&quot; (because that is not a &quot;source&quot;, there is nothing to compile in it; but a &quot;resource&quot;, which normally gets added otherwise to the classpath as analyzed above) BUT if I keep seeing this problem, may still be a viable workaround. Later.&lt;/p&gt;</comment>
                            <comment id="54401" author="filip.gregor@pantheon.tech" created="Tue, 26 Jul 2016 13:06:25 +0000"  >&lt;p&gt;As far as i can tell we were unable to replicate this bug so i suggest we decrease its severity and you can take it if you want to work on it further&lt;/p&gt;</comment>
                            <comment id="54402" author="vorburger" created="Tue, 26 Jul 2016 15:33:00 +0000"  >&lt;p&gt;&amp;gt; As far as i can tell &lt;/p&gt;

&lt;p&gt;Sorry if above yesterday was more of a monologue.. &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.opendaylight.org/images/icons/emoticons/wink.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;  Tired yesterday.  Now slept over it.&lt;/p&gt;

&lt;p&gt;&amp;gt; we were unable to replicate this bug&lt;/p&gt;

&lt;p&gt;Here is one way to reliably reproduce it: &lt;/p&gt;

&lt;p&gt;$ mvn clean generate-sources&lt;br/&gt;
$ find -name services        &lt;br/&gt;
./target/generated-sources/spi/META-INF/services&lt;/p&gt;

&lt;p&gt;and test in IDE will fail (even after a F5 refresh). This is &quot;normal&quot;, based on what we learnt above, because the copy of META-INF/services from target/generated-sources/spi to target/classes would be done by the maven-resources-plugin in a later phase, which (we ask it to/) did not run.  But this is not &quot;convenient&quot; (or &quot;end user expected&quot;) ...&lt;/p&gt;

&lt;p&gt;A Project &amp;gt; Clean... or right-click Maven &amp;gt; Update Project, fixes it, because that will run the maven-resources-plugin through M2E, and one would then now see the correct result which a full e.g. &quot;mvn clean install&quot; would have also produced:&lt;/p&gt;

&lt;p&gt;$ find -name services&lt;br/&gt;
./target/classes/META-INF/services&lt;br/&gt;
./target/generated-sources/spi/META-INF/services&lt;/p&gt;



&lt;p&gt;&amp;gt; you can take it if you want to work on it further&lt;/p&gt;

&lt;p&gt;I&apos;ve seen this behave the way I want it to / think it should by more explicitly telling Maven about target/generated-sources/spi (which as we&apos;ve seen above NORMALLY we already do it in code, but...) so by adding this:&lt;/p&gt;

&lt;p&gt;  &amp;lt;build&amp;gt;&lt;br/&gt;
    &amp;lt;resources&amp;gt;&lt;br/&gt;
      &amp;lt;resource&amp;gt;&lt;br/&gt;
        &amp;lt;directory&amp;gt;target/generated-sources/spi/&amp;lt;/directory&amp;gt;&lt;br/&gt;
      &amp;lt;/resource&amp;gt;&lt;br/&gt;
    &amp;lt;/resources&amp;gt;&lt;/p&gt;

&lt;p&gt;Now Eclipse (but NOT Maven, on mvn generate-sources, which is NORMAL) has target/generated-sources/spi always a source folder, which makes sense IMHO, and this will cause Eclipse to always copy of META-INF/services from target/generated-sources/spi to target/classes!  &lt;/p&gt;


&lt;p&gt;Having resolved that, there is now a similar problem re. META-INF/yang/*.yang, which manifests itself like this:&lt;/p&gt;

&lt;p&gt;java.lang.ExceptionInInitializerError&lt;br/&gt;
	at org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.api.rev160608.$YangModelBindingProvider.getModuleInfo($YangModelBindingProvider.java:6)&lt;br/&gt;
	at org.opendaylight.yangtools.yang.binding.util.BindingReflections.loadModuleInfos(BindingReflections.java:374)&lt;br/&gt;
	at org.opendaylight.yangtools.yang.binding.util.BindingReflections.loadModuleInfos(BindingReflections.java:347)&lt;br/&gt;
	at org.opendaylight.controller.md.sal.binding.test.AbstractSchemaAwareTest.getModuleInfos(AbstractSchemaAwareTest.java:23)&lt;br/&gt;
	at org.opendaylight.controller.md.sal.binding.test.AbstractSchemaAwareTest.setup(AbstractSchemaAwareTest.java:29)&lt;br/&gt;
(...)&lt;br/&gt;
Caused by: java.lang.IllegalStateException: Resource &apos;/META-INF/yang/aclservice-api.yang&apos; is missing&lt;br/&gt;
	at org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.api.rev160608.$YangModuleInfoImpl.&amp;lt;init&amp;gt;($YangModuleInfoImpl.java:30)&lt;br/&gt;
	at org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.api.rev160608.$YangModuleInfoImpl.&amp;lt;clinit&amp;gt;($YangModuleInfoImpl.java:10)&lt;br/&gt;
	... 29 more&lt;/p&gt;

&lt;p&gt;As we see with e.g. find -wholename &quot;&lt;b&gt;/META-INF/yang/&lt;/b&gt;&quot; :&lt;/p&gt;

&lt;p&gt;./target/classes/META-INF/yang/aclservice.yang&lt;br/&gt;
./target/classes/META-INF/yang/aclservice-api.yang&lt;br/&gt;
./target/generated-sources/yang/META-INF/yang/aclservice.yang&lt;br/&gt;
./target/generated-sources/yang/META-INF/yang/aclservice-api.yang&lt;/p&gt;

&lt;p&gt;This is the same all over - &lt;b&gt;.yang sources are in src/main/yang/&lt;/b&gt;.yang and then must end up on the classpath under META-INF/yang. Again the CLI build does this of course, but Eclipse unfortunately sometimes needs a kick (clean) to copy them. Again simply using the same as above helps:&lt;/p&gt;

&lt;p&gt;  &amp;lt;build&amp;gt;&lt;br/&gt;
      &amp;lt;resource&amp;gt;&lt;br/&gt;
        &amp;lt;directory&amp;gt;target/generated-sources/yang&amp;lt;/directory&amp;gt;&lt;br/&gt;
      &amp;lt;/resource&amp;gt;&lt;/p&gt;

&lt;p&gt;It would actually perhaps be best if at source they were simply under src/main/yang/META-INF/yang/&lt;b&gt;.yang? Or perhaps even just src/main/resources/META-INF/yang/&lt;/b&gt;.yang, really... But it&apos;s probably too late to now change this to either everywhere. The 3 &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.opendaylight.org/images/icons/emoticons/warning.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; copies of each YANG file we have in each project are all the same, of course:&lt;/p&gt;

&lt;p&gt;diff src/main/yang/aclservice.yang target/classes/META-INF/yang/aclservice.yang&lt;br/&gt;
diff target/classes/META-INF/yang/aclservice.yang target/generated-sources/yang/META-INF/yang/aclservice.yang&lt;/p&gt;


&lt;p&gt;With these two additions to pom.xml, as far as I can tell so far, I&apos;m never seeing the problem that this bug was all about anymore.  &lt;/p&gt;

&lt;p&gt;I&apos;ll therefore raise a Gerrit proposing that we add (both of) this.&lt;/p&gt;


&lt;p&gt;PS: Instead of &amp;lt;build&amp;gt;&amp;lt;resources&amp;gt; the build-helper-maven-plugin comes to mind as well. It can add additional source folders, because &amp;lt;build&amp;gt; &amp;lt;sourceDirectory&amp;gt; only takes one.  It also has &amp;lt;goal&amp;gt;add-resource for adding additional resource folder. But standard &amp;lt;build&amp;gt; already allows for &amp;lt;resources&amp;gt;&amp;lt;resource&amp;gt; so not sure what the point of that feature in build-helper-maven-plugin is; just using &amp;lt;build&amp;gt;&amp;lt;resources&amp;gt; seems more... standard.&lt;/p&gt;</comment>
                            <comment id="54403" author="vorburger" created="Tue, 26 Jul 2016 15:55:15 +0000"  >&lt;p&gt;Adding target/generated-sources/yang causes &quot;Naming conflict for type &apos;org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.InterfaceAcl&apos;: file with same name already exists and will not be generated.&quot; warnings to be shown in the (Eclipse) IDE - probably from yangide and/or M2E calling into yang-maven-plugin etc.&lt;/p&gt;

&lt;p&gt;Therefore I now find it&apos;s best if we NOT register src/main/yang as a source directory in binding-parent, to avoid the duplicate on classpath.  The problem described on &lt;a href=&quot;https://lists.opendaylight.org/pipermail/yangtools-dev/2016-May/001383.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://lists.opendaylight.org/pipermail/yangtools-dev/2016-May/001383.html&lt;/a&gt; which adding src/main/yang as a source by me in &lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/39277/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/39277/&lt;/a&gt; solved will still be OK (not regress), because the *.yang models in dependant projects should still be found - just now from target/generated-sources/yang (under META-INF/yang), instead of from src/main/yang.&lt;/p&gt;

&lt;p&gt;PS: The add-source of src/main/yang to config-parent in &lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/39275/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/39275/&lt;/a&gt; seems unnecessary in retrospect, as config-parent inherits from binding-parent anyway, so that was a dupe. I&apos;ll remove it as part of this work as well.&lt;/p&gt;</comment>
                            <comment id="54404" author="vorburger" created="Tue, 26 Jul 2016 16:13:03 +0000"  >&lt;p&gt;&amp;gt; best if we NOT register src/main/yang as a source directory&lt;/p&gt;

&lt;p&gt;The transition to this is slightly complicated by the fact that M2E is too dumb to remove a Source Folder once it has added it, so even with the changes in binding-parent &amp;amp; config-parent, all already existing projects in an Eclipse workspace still have src/main/yang as a source directory, even after a full right-click Maven &amp;gt; Update Project.  You have to actually manually Remove src/main/yang as Source folder from the Java Build Path in the Project &amp;gt; Properties.  Or just rm all .classpath files and start over.&lt;/p&gt;</comment>
                            <comment id="54405" author="vorburger" created="Tue, 26 Jul 2016 16:35:20 +0000"  >&lt;p&gt;&lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/42585/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/42585/&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/42586/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/42586/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="54406" author="vorburger" created="Wed, 10 Aug 2016 09:25:26 +0000"  >&lt;p&gt;&lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/43594/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/43594/&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="13807" name="GetResourcesYangModelBindingProviderBugReproducerTest.java" size="690" author="vorburger" created="Mon, 25 Jul 2016 14:35:39 +0000"/>
                            <attachment id="13806" name="bug6252-stacktrace.txt" size="7420" author="vorburger" created="Fri, 22 Jul 2016 11:01:59 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_11400" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10208" key="com.atlassian.jira.plugin.system.customfieldtypes:textfield">
                        <customfieldname>External issue ID</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6252</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10201" key="com.atlassian.jira.plugin.system.customfieldtypes:url">
                        <customfieldname>External issue URL</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[https://bugs.opendaylight.org/show_bug.cgi?id=6252]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10206" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Issue Type</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10300"><![CDATA[Bug]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10204" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>ODL SR Target Milestone</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10309"><![CDATA[Boron]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i02wvb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>