ie. I have got a class file which was complied. I didn’t have its source code. I want to reuse it in my module, maybe. So, how can I import it in DHIS2 ? Expecting for you all idea.
ie. I have got a class file which was complied. I didn’t have its source code. I want to reuse it in my module, maybe. So, how can I import it in DHIS2 ? Expecting for you all idea.
ie. I have got a class file which was complied. I didn’t have its source code. I want to reuse it in my module, maybe. So, how can I import it in DHIS2 ? Expecting for you all idea.
Because dhis is built using maven then all such dependencies must be handled by maven. So the compiled class would have to be fetched from a maven repository which makes the licence issue quite important. You can load it in to a local repository but that doesn’t help the global build process. Much though maven drives me crazy, this is possibly a good side effect in that it keeps us clean (licence wise).
ie. I have got a class file which was complied. I didn’t have its source code. I want to reuse it in my module, maybe. So, how can I import it in DHIS2 ? Expecting for you all idea.
it wouldn´t generally be a good idea to add such a class to dhis. But, if it had to be done anyway, it is possible (and not that difficult) to do it without adding it as an external dependency. Typically by telling maven to copy the class to target, in the same way that resources is copied.
Thanks Bob very much. The license wise, yup ! Also, always remember one slogan “Freedom not Free”. But I think we should notice on Jo’s opinion. Can I have you tell us more about the external dependencies what’s kind of them ? They’re also declared as the origin one into pom.xml file, aren’t they ? Anyway, If I have the license’s information of that/those class(es). So, what should we do in this case ?
Thanks to guys’ great idea !
···
On Fri, Oct 30, 2009 at 9:52 PM, Jo Størset storset@gmail.com wrote:
Hi,
it wouldn´t generally be a good idea to add such a class to dhis. But, if it had to be done anyway, it is possible (and not that difficult) to do it without adding it as an external dependency. Typically by telling maven to copy the class to target, in the same way that resources is copied.
Thanks Bob very much. The license wise, yup ! Also, always remember one slogan “Freedom not Free”. But I think we should notice on Jo’s opinion.
Yes noticed! Jo is the maven master not me Though I think he is right to point out that, though it can be done its not really a good way to go about it.
Can I have you tell us more about the external dependencies what’s kind of them ? They’re also declared as the origin one into pom.xml file, aren’t they ? Anyway, If I have the license’s information of that/those class(es). So, what should we do in this case ?
Thanks to guys’ great idea !
On Fri, Oct 30, 2009 at 9:52 PM, Jo Størset storset@gmail.com wrote:
Hi,
it wouldn´t generally be a good idea to add such a class to dhis. But, if it had to be done anyway, it is possible (and not that difficult) to do it without adding it as an external dependency. Typically by telling maven to copy the class to target, in the same way that resources is copied.
Yes noticed! Jo is the maven master not me Though I think he is right to point out that, though it can be done its not really a good way to go about it.
Cheers
Bob
On Fri, Oct 30, 2009 at 9:52 PM, Jo Størset storset@gmail.com wrote:
Hi,
it wouldn´t generally be a good idea to add such a class to dhis. But, if it had to be done anyway, it is possible (and not that difficult) to do it without adding it as an external dependency. Typically by telling maven to copy the class to target, in the same way that resources is copied.
I feel the need to stress that there generally are better solutions to this. Just writing what you need from scratch is generally worth the effort in small cases. If that isn´t feasible, I need to know more about the context.
You could just put the class in the src/main/resources directory, but [1] tells you how to setup a second resources directory ("classes"?), where you could put the class (in it´s correct place in the package structure)
Jo does this mean that you can technically bypass the repo mechanism and include jars as resources? Probably again not to be encouraged but there are instances where you have a jar which doesn’t exist in maven repo. A situation I had recently.
A better solution I know is to set up an internal repository.
I feel the need to stress that there generally are better solutions to this. Just writing what you need from scratch is generally worth the effort in small cases. If that isn´t feasible, I need to know more about the context.
You could just put the class in the src/main/resources directory, but [1] tells you how to setup a second resources directory (“classes”?), where you could put the class (in it´s correct place in the package structure)
Jo does this mean that you can technically bypass the repo mechanism and include jars as resources?
Yes, it is easy (but needs a little tweak compared to resources going to the classpath). But an important point with maven is the use standardized mechanisms, whenever possible.
Probably again not to be encouraged but there are instances where you have a jar which doesn't exist in maven repo. A situation I had recently.
If you send me the details, I can set up a repo on dhis.uio.no/maven for dependencies that is missing from existing maven repos (With ssh access to dhis2.org, I guess we might set it up there, as well).