Skip to content

Instantly share code, notes, and snippets.

@ko2ic
Last active August 29, 2015 14:00
Show Gist options
  • Save ko2ic/11081557 to your computer and use it in GitHub Desktop.
Save ko2ic/11081557 to your computer and use it in GitHub Desktop.
mavenですべての設定ファイルを自動生成させる方法 ref: http://qiita.com/ko2ic/items/39be03afbc6c38c409ea
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle-configurations file-format-version="5.0.0" default-check-configuration="Sun Checks">
<check-configuration name="sa-checkstyle" location="https://raw.githubusercontent.com/ko2ic/java-config/master/sa-checkstyle-5.6-utf8.xml" type="remote" description="">
<additional-data name="cache-file" value="false"/>
</check-configuration>
</checkstyle-configurations>
<profile>
<id>conf</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>set-custom-property</id>
<phase>validate</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
project.properties.setProperty('main.basedir',
project.parent.basedir.toString())
</source>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.9.3</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<target>
<copy file="${main.basedir}/config/checkstyle-config.xml" tofile="${eclipse.workspace}/.metadata/.plugins/net.sf.eclipsecs.core/checkstyle-config.xml" overwrite="true" />
<copy file="${main.basedir}/config/org.eclipse.jdt.ui.prefs" tofile="${eclipse.workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs"
overwrite="true" />
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<additionalConfig>
<file>
<name>.settings/.metadata/.plugins/org.eclipse.debug.core/.launches/open finder.launch</name>
<content><![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="/usr/bin/open"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="${container_loc}"/>
</launchConfiguration>
]]>
</content>
</file>
$ mvn process-resources eclipse:eclipse -Pconf -Declipse.workspace=<Eclipseのworkspace>
・・・
formatter_profile=_Ko2ic Formatter
・・・
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.9.3</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>gen-launches</id>
<phase>process-resources</phase>
<configuration>
<target>
<mkdir dir=".settings/temp/" />
<move todir="${eclipse.workspace}/">
<fileset dir=".settings/temp/" includes="**/*" />
</move>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<eclipse.workspace>/Users/hoge/sources/workspace</eclipse.workspace>
</properties>
</profile>
</profiles>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<additionalConfig>
<file>
<name>.settings/.metadata/.plugins/org.eclipse.debug.core/.launches/open finder.launch</name>
<content><![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="/usr/bin/open"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="${container_loc}"/>
</launchConfiguration>
]]>
</content>
</file>
<profile>
<id>conf</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<additionalBuildcommands>
<buildcommand>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</buildcommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</projectnature>
</additionalProjectnatures>
<additionalConfig>
<file>
<name>.checkstyle</name>
<content>
<![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="true">
<fileset name="all" enabled="true" check-config-name="sa-checkstyle" local="false">
<file-match-pattern match-pattern="." include-pattern="true"/>
</fileset>
<filter name="NonSrcDirs" enabled="true"/>
</fileset-config>
]]>
</content>
</file>
<file>
<name>.settings/org.eclipse.core.resources.prefs</name>
<content>
<![CDATA[eclipse.preferences.version=1${line.separator}encoding/<project>=${project.build.sourceEncoding}${line.separator}]]>
</content>
</file>
</additionalConfig>
<workspace>${eclipse.workspace}</workspace>
<workspaceCodeStylesURL>https://raw.githubusercontent.com/ko2ic/java-config/master/codeformatter-7.xml</workspaceCodeStylesURL>
<workspaceActiveCodeStyleProfileName>Ko2ic Formatter</workspaceActiveCodeStyleProfileName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment