Adding a Project to Tomcat Path in IntelliJ IDEA

In Eclipse, I am adding Tomcat Server. I click "Open Run Configuration", and in the Change Configuration dialog box, the Classpath tab. I can add an Eclipse project to the path of the User Records class.

Now I want to achieve the same in IntelliJ Idea. This project has property files (configuration files) that are shared by many WAR servers.

What I have tried so far:

In IDEA, servers are configured in the Application Servers dialog box. There I see Tomcat banks in the Libraries section, and you can attach files or directories. I tried this to add my properties folder inside the project. I also packaged the project in a JAR (I use Maven) and added this archive. Unfortunately, I had no success.

+4
source share
3 answers

You can also add a configuration file and properties / folders in the created deployment artifact (war / detonated war) for your application. These files / folders will be deleted when you clear the deleted artifact. But it would be nice to have an automatic way to do this using only the intellij IDE.

0
source

I have a similar problem. I could not solve it the way Eclipse does, but I found a solution.

The only solution I found was to include a link to the project / resources in the pom file. This may include a resource tag inside an assembly tag.

<build> ... <resources> <resource> <directory>path/to/resources</directory> <filtering>false</filtering> </resource> </resources> 

If you need resources for testing, you can do the following:

 ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.9</version> <configuration> <additionalClasspathElements> <additionalClasspathElement>path/to/additional/resources</additionalClasspathElement> <additionalClasspathElement>path/to/additional/jar</additionalClasspathElement> </additionalClasspathElements> </configuration> </plugin> </plugins> </build> ... 

The problem that I see in this solution is that I have to add the resource path and commit this change to pom. Any other developer who can have these resources in a separate folder will need to change pom to indicate the location of their resources.

By the way, I got some of this solution from the next conversation.

http://maven.40175.n5.nabble.com/How-to-add-a-folder-to-the-classpath-used-during-maven-build-td4754387.html

0
source

Source: https://habr.com/ru/post/1447098/


All Articles