How could import a class file in DHIS2

Dear all,

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.

Thank you guys !

···


Hieu.HISPVietnam
Good Health !

Hieu - one aspect is how to do this technically. Another is license: Where does this come from, and under what license?

Knut

···

On Fri, Oct 30, 2009 at 4:23 AM, Hieu Dang Duy hieu.hispvietnam@gmail.com wrote:

Dear all,

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.

Thank you guys !


Hieu.HISPVietnam
Good Health !


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Cheers,
Knut Staring

Oh my god !

Thanks Knut, you have reminded me about the license. I forgot in this issue.
About the technique always a still question. ^_~

···

On Fri, Oct 30, 2009 at 4:33 PM, Knut Staring knutst@gmail.com wrote:

Hieu - one aspect is how to do this technically. Another is license: Where does this come from, and under what license?

Knut

On Fri, Oct 30, 2009 at 4:23 AM, Hieu Dang Duy hieu.hispvietnam@gmail.com wrote:

Dear all,

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.

Thank you guys !


Hieu.HISPVietnam
Good Health !


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Cheers,
Knut Staring


Hieu.HISPVietnam
Good Health !

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).

Regards
Bob

···

2009/10/30 Hieu Dang Duy hieu.hispvietnam@gmail.com

Oh my god !

Thanks Knut, you have reminded me about the license. I forgot in this issue.
About the technique always a still question. ^_~

On Fri, Oct 30, 2009 at 4:33 PM, Knut Staring knutst@gmail.com wrote:

Hieu - one aspect is how to do this technically. Another is license: Where does this come from, and under what license?

Knut

On Fri, Oct 30, 2009 at 4:23 AM, Hieu Dang Duy hieu.hispvietnam@gmail.com wrote:

Dear all,

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.

Thank you guys !


Hieu.HISPVietnam
Good Health !


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Cheers,
Knut Staring


Hieu.HISPVietnam
Good Health !


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

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.

Jo

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.

Jo


Hieu.HISPVietnam
Good Health !

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 :slight_smile: 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

···

2009/10/30 Hieu Dang Duy hieu.hispvietnam@gmail.com

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.

Jo


Hieu.HISPVietnam
Good Health !

Again thank you for agreement with Jo master of “kung fu maven” :slight_smile:

Hopefully that, will be learned more from Jo’s suggestion.

3 and cheers !

···

On Sat, Oct 31, 2009 at 12:42 AM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Yes noticed! Jo is the maven master not me :slight_smile: 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.

Jo


Hieu.HISPVietnam
Good Health !


Hieu.HISPVietnam
Good Health !

Hi,

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)

[1] http://maven.apache.org/plugins/maven-resources-plugin/examples/resource-directory.html

Jo

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.

Cheers
Bob

···

2009/10/31 Jo Størset storset@gmail.com

Hi,

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)

[1] http://maven.apache.org/plugins/maven-resources-plugin/examples/resource-directory.html

Jo

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).

Jo

···

Den 31. okt. 2009 kl. 12.09 skrev Bob Jolliffe: