Project

General

Profile

Developing with IntelliJ?

Matt Q Public
Added over 1 year ago

I'm new at this. I apologize in advance...

Normally I just add the maven repo to my gradle build file and start coding. No problem.

I have read section 2 of the Development Docs and gotten the server code to load into IntelliJ, but there's always something missing, it throws a ton of errors, and even the documentation doesn't say where to create your classes, etc.

Is anyone else developing for Tigase with IntelliJ, and if so, how are you accomplishing this?


Replies (9)

(1)

Added by Wojciech Kapcia TigaseTeam over 1 year ago

Matt Q Public wrote:

Normally I just add the maven repo to my gradle build file and start coding. No problem.

Could you elaborate? You add it as a dependency? What you add exactly?

I have read section 2 of the Development Docs and gotten the server code to load into IntelliJ, but there's always something missing, it throws a ton of errors, and even the documentation doesn't say where to create your classes, etc.

Sharing what errors are thrown would be helpful :-)

Also - what are you trying to achieve? Build the server? Add functionality? Customise it?

Is anyone else developing for Tigase with IntelliJ, and if so, how are you accomplishing this?

It turned out we mostly use Jetbrains IDEA so yeah - it works (there is also highlighter for new configuration file format).

You simply:

  • clone the tigase-server repository

  • open the project in idea - it will add all maven modules.

Added by Matt Q Public over 1 year ago

Okay, that's great. I was reading section 2 of the Developer Docs, and it sounded like a much bigger problem than it actually was. I have cloned the tigase-server code into a folder, and opened that as a project. It seems to see everything, and I don't have any errors.

I would like to develop a Component. How do I do that?

Right now if I create a new module, then create a new class, and type something like "import tigase.server.AbstractMessageReceiver;" it doesn't know what that means.

Added by Matt Q Public over 1 year ago

Just got it working. Thanks. The Developer Guide was written for Eclipse, and I tried to approximate those instructions for IntelliJ. Big fail.

I still don't understand where to create my new classes, etc. And when I build the project, can I just build my new component, and add it to an existing install of Tigase Server?

(1)

Added by Wojciech Kapcia TigaseTeam over 1 year ago

Matt Q Public wrote:

Just got it working. Thanks. The Developer Guide was written for Eclipse, and I tried to approximate those instructions for IntelliJ. Big fail.

Developer guide was written in an universal way. There is a chapter how to execute and debug project in Eclipse but that's a special case.

I still don't understand where to create my new classes, etc. And when I build the project, can I just build my new component, and add it to an existing install of Tigase Server?

Yes, that's the idea.

In principle how you should go about working with Tigase (creating new component / plugin):

  • create new project in IDEA;

  • add tigase-server as dependency - depending whether you use build tool (for example maven, gradle) or use only IDEA to handle builds this is a bit different; we recommend using Maven and you simply add:

        <dependency>
            <groupId>tigase</groupId>
            <artifactId>tigase-server</artifactId>
            <version>8.0.0-SNAPSHOT</version>
        </dependency>

And then create your component/plugin following appropriate guide from the Developer documentation.

Added by Matt Q Public over 1 year ago

Thanks for your help so far. I've cloned the 8.0.0-SNAPSHOT code to a folder. If I open that folder with IntelliJ, I am told the POM file contains errors on the following lines:

<dist-dir>${myproject.basedir}/distribution-packages/</dist-dir>   Cannot resolve myproject.basedir
<finalName>${project.artifactId}-${gitVersion}</finalName>   Cannot resolve gitVersion
<autoVersionSubmodules>true</autoVersionSubmodules>   autoVersionSubmodules is not allowed here

I have tried creating a new project (as you suggested) and adding the dependency (as you wrote it above) to the POM file, but that results in a very large error message that looks like this:

Invalid content was found starting with element dependency... Then lots of URLs.

What do I try next? Or can you explain how to create a new project and add your code as a dependency step-by-step?

Thanks.

Added by Matt Q Public about 1 year ago

Bump.

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam about 1 year ago

Wojciech already told you that you need to create your own Maven project and which lines you need to add as a dependency. However, you need to add them in the correct place within XML structure. For that, I would recommend consulting with Maven documentation, see guides and documentation at http://maven.apache.org/guides/

As for our project XML, lines marked as containing errors within IDEA are correct, but IDEA is not aware of additional variables which we defined within maven project and due to that it reports errors.

Added by Matt Q Public about 1 year ago

Thanks. I'll read the Maven guide and ignore those IDEA errors.

Added by Matt Q Public about 1 year ago

This is what I added to the POM file to get it working:

    <groupId>tigase</groupId>

    <artifactId>tigase-server</artifactId>

    <version>8.0.0-SNAPSHOT</version>

</dependency></dependencies>

<repositories>

    <repository>

        <id>tigase</id>

        <name>Tigase repository</name>

http://maven-repo.tigase.org/repository/release

    </repository>

    <repository>

        <id>tigase-snapshot</id>

        <name>Tigase repository</name>

http://maven-repo.tigase.org/repository/snapshot

        <snapshots>

            <enabled>true</enabled>

        </snapshots>

    </repository>

</repositories> 

    (1-9/9)