According https://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Defining_a_context and https://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Naming Tomcat 9 allows making individual application `context.xml` (working is checked).
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.7.10</version>
<configuration>
<container>
<containerId>tomcat9x</containerId>
<systemProperties>
<file.encoding>UTF-8</file.encoding>
<spring.profiles.active>tomcat,datajpa</spring.profiles.active>
</systemProperties>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
</dependencies>
</container>
<configuration>
<configfiles>
<configfile>
<file>src/main/resources/tomcat/context.xml</file>
<todir>conf/Catalina/localhost/</todir>
<tofile>${project.build.finalName}.xml</tofile>
</configfile>
</configfiles>
</configuration>
<deployables>
<deployable>
<groupId>ru.javawebinar</groupId>
<artifactId>topjava</artifactId>
<type>war</type>
<properties>
<context>${project.build.finalName}</context>
</properties>
</deployable>
</deployables>
</configuration>
</plugin>
</plugins>
What a mess. I don't remember where I found this but I had to add the following to get M2Eclipse to be happy. Even more sad is that it isn't exactly easy to understand why this tag is needed.
<!-- language: xml -->
<build>
... various plugins ...
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse
m2e settings only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<versionRange>[1.0,)</versionRange>
<goals>
<goal>test-compile</goal>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
There were a number of other issues with the M2Eclipse plug-in that simply didn't work with Spring Data. In the end I disabled M2Eclipse in favor of the [Apache Eclipse plug-in][1].
[1]: http://maven.apache.org/plugins/maven-eclipse-plugin/