Can I change rapidminer5's code for extension project?

21310122
21310122 New Altair Community Member
edited November 5 in Community Q&A

I am using RapidMiner5 and want to develop the extension project with RapidMiner5.

rapidminer5.jpg

 

In order to develop the extension project, I changed some code in RapidMiner. Because some method in RapidMiner5 is private or protected. 

 

public1.png

 public2.png

 

I tested the code just in extension project and get the successful result, but when I built it to generate plugin in RapidMiner5, it got error.

From the error message, the modified code is not recognized correctly.
puclicerror.png

 

But I checked the class file in RapidMiner5, it's the lastest code. The method is "public" now.
public3.png

 

So why I got these error message?

 

Best Answer

  • jczogalla
    jczogalla New Altair Community Member
    Answer ✓

    Hi @21310122!

     

    I think I see the solution now... I guess you have the RapidMiner5 project on your extension's classpath, correct? Then of course it can see the changes that you made. But when the extension is built, it will not use the classes built by eclipse, but instead it will use the rapidminer.jar library. Of course this is still the unmodified version. To rebuild the rapidminer.jar library, simply execute the createJar task from within the RapidMiner5 project. That should solve your problem.

     

    Cheers

    Jan

Answers

  • jczogalla
    jczogalla New Altair Community Member

    I'm not sure why exactly you get that error. But there is a much easier way to circumvent it without changing the core code. You can use

    AttributeFactory.create(h20Node.getColname(), Ontology.POLYNOMINAL)

    to create your Attribute. That's the usual way to do it.


    Cheers

    Jan

  • 21310122
    21310122 New Altair Community Member

    That works, thank you a lot!:smileyvery-happy:

     

    Although I still don't know why I can't do in this way.
    If I can't get correct result in this way, if that means any changes in the RapidMiner source level can not be effective?

    I wish someone can find out the cause of the mistake.

     

  • jczogalla
    jczogalla New Altair Community Member

    I'm not completely sure what the problem there is. This is still using the (now old) ant build mechanism. Can you maybe translate the java compiler error? That would definitely help. :)
    Also, how do you build the extension? Are you sure the ant file is correctly configured, i.e. the rm.dir variable points to your modified RapidMiner5 project?

  • 21310122
    21310122 New Altair Community Member

    Sorry, It was my fault that I didn't notice that the error message is in Chinese. It's said that there is no such method( use String parameter to create a PolynominalAttribute).

     

    puclicerror.png 

     

    I used the way you told me and built it, the error of creating PolynominalAttribute is fixed.

    But I still have other changed code in RapidMiner which cannot be recoginized in extension-project.

    The error message means no such method setLabel() and new Tree().

     

     publicerror2.png

     publicmethod.png     publicmethod2.png

     

    That's so weird because the IDEA didn't prompt me that there is a problem with the code. And I created a test class to call this method in extension-project, I got the success result.

    But when I built it with RapidMiner5, the error message comes. 

     

    This is the project location and the configuration file in extension-project. 

     location2.pnglocation.png

     

    I got the **.jar in RapidMiner5 after build extension-project in the situation that I didn't use changed RapidMiner5's code in extension-project. So I think there is no problem with the location configuration. 

    buildjar.png

     

    Can you help me to find out the reason and solve it? Thanks a lot.

    @jczogalla

  • jczogalla
    jczogalla New Altair Community Member
    Answer ✓

    Hi @21310122!

     

    I think I see the solution now... I guess you have the RapidMiner5 project on your extension's classpath, correct? Then of course it can see the changes that you made. But when the extension is built, it will not use the classes built by eclipse, but instead it will use the rapidminer.jar library. Of course this is still the unmodified version. To rebuild the rapidminer.jar library, simply execute the createJar task from within the RapidMiner5 project. That should solve your problem.

     

    Cheers

    Jan

  • 21310122
    21310122 New Altair Community Member

    Thank you soooooo much!

    The problem solved.