질문에 설명 된 접근 방식을 사용하여 Git 저장소에있는 README.md
파일에 대해이 문제를 해결했습니다. 즉, README.md
을 루트 디렉토리에서 으로 복사합니다. 파일을 복사하려면 maven-resources-plugin
을 사용했습니다. 사이트가 생성 된 후 SCM 오염을 피하기 위해 복사 된 파일을 제거하는 대신, .gitignore
에 Bruno suggested과 같이 추가했습니다.
솔루션에 대한 자세한 설명은 다음과 같습니다. pom.xml
의 섹션 project.build.plugins
에서
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<!-- Copy the readme file to the site source files so that a page is generated from it. -->
<id>copy-readme</id>
<phase>pre-site</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/site/markdown</outputDirectory>
<resources>
<resource>
<directory>${basedir}</directory>
<includes>
<include>README.md</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
.gitignore
에서 :
# Copied from root to site source files by maven-resources-plugin
/src/site/markdown/README.md
당신은 here 커밋 해당 볼 수 있습니다.
git을 사용하는 경우 복사 된 파일을 .gitignore에 추가하여 이러한 파일이 소스 트리에 추가되지 않도록 할 수 있습니다. 나는 다른 VCS가 비슷한 메커니즘을 가지고 있다고 가정한다. –