1

I am using the following build plugin to redirect my war file into tomcat webapps dir. But this is a personal choice and breaks other devs' build. Is there a way to gitignore just this part in pom.xml file?

 <build>
    ...
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.3.1</version>
        <configuration>
          <webappDirectory>../tomcat/webapps/shared-project/</webappDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
paulz
  • 185
  • 2
  • 10
  • 3
    Put it in a profile. – tgdavies Dec 12 '20 at 06:58
  • Does this answer your question? [Can git ignore a specific line?](https://stackoverflow.com/questions/6557467/can-git-ignore-a-specific-line) – Joe Dec 12 '20 at 09:50
  • Why do you use a webapp directory which is not located within the same location as your war build is located? – khmarbaise Dec 12 '20 at 12:27
  • I have 5 API projects to run in tomcat, so could not setup tomcat just for a single project – paulz Dec 13 '20 at 08:18
  • @Joe The solution is so ugly. After I add a new dependency, I will have to change git ignore filter. I prefer a solution within java pom.xml file and project setup. I am not alone with this situation, am I? – paulz Dec 13 '20 at 09:04
  • 1
    @tgdavies Can you answer the question? It looks like the answer I am searching for. Testing now. Thanks. – paulz Dec 13 '20 at 09:15
  • @paulz the best solution is (almost) always to commit the change, and make it flexible enough not to cause problems for others. Here, that's a profile. But, strictly speaking, the dupe answers your specific question. – Joe Dec 13 '20 at 12:17
  • I ended up using a `config.properties` file and use a maven plugin to parse properties into `pom.xml` and java classes. Then `config.properties` gets gitignored, but I provide an `example.config.properties` for others to set differently. – paulz Dec 20 '20 at 14:42

0 Answers0