How to set eclipse project specific validation pre

2019-08-27 16:47发布

When invoking importing maven projects into eclipse from git using "Import Maven Projects" the m2e plugins to seems to generate a new .project and .classpath and some other files even though those files are checked in.

To get around this problem I would like to not check in any eclipse specific files, but there are customizations made to each project file such as custom save actions, or changes to the validation to ignore specific things, or changes to the javascript configuration for a dynamic web project that need to be preserved, so either those files need to checked or those settings need to be generated by m2e.

Any way to use m2e to configure the eclipse project validators?

3条回答
倾城 Initia
2楼-- · 2019-08-27 17:10

The other answer has suggested the solution with eclipse. But if you are flexible with using a different IDE, I suggest using Netbeans with git. I tested both IDEs and finally found out I could save time in different cases using Netbeans! No such problems as mentioned above.

查看更多
戒情不戒烟
3楼-- · 2019-08-27 17:15

We had a similar problem in the past. We solved it by

  • don't checkin eclipse specific files (svn ignore, git ignore, ...)
  • Use Workspace Mechanic plugin to keep eclipse settings the same accross development machines / developers.
查看更多
做个烂人
4楼-- · 2019-08-27 17:24

I made m2e-codestyle-maven-plugin for another purpose but it should serve what you need as well (in my case I wanted to set the default settings to have all validations turned on from my coding-standards project.

The key thing you have to do is fork a copy of my coding-standards project and add/change the appropriate setting in org.eclipse.wst.validation.prefs namely

vals/org.eclipse.wst.xml.core.xml/global=FF03

To disable the validations for XML for example. You can have it activated only on m2e by using profiles as shown here

https://github.com/trajano/jee/blob/master/jee-domain-api/pom.xml#L24

<profile>
  <id>m2e</id>
  <activation>
    <property>
      <name>m2e.version</name>
    </property>
  </activation>
  <build>
    <plugins>
      <plugin>
        <groupId>net.trajano.mojo</groupId>
        <artifactId>m2e-codestyle-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>configure</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>net.trajano</groupId>
            <artifactId>coding-standards</artifactId>
            <version>${coding-standards.version}</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
</profile>
查看更多
登录 后发表回答