developing maven plugin, how to exclude bitkeeper files
I开发者_开发百科'm writing a maven 2 plugin and I'd like to exclude all the java files related to the source repository I'm using, which is BitKeeper. These files live in directories called SCCS. So far, I've been unsuccessful.
When I add the maven-compile-plugin with excludes data, it works (the BitKeeper files are excluded) if I execute mvn compiler:compile. But this is not binding to the compile phase. So that when I run mvn compile, it blows up trying to compile a source control specific java file. Any help or pointers appreciated.
Another thing to note: Everything works perfectly if I change the packaging from "maven-plugin" to "jar", which of course, I can't do permanently since this is a maven plugin I am trying to write.
I'm sorry if this is answered elsewhere. I've looked around for several hours here and through the maven docs, but everything on this topic seems to be related to writing code which will be packaged in jars, not maven plugins.
Here's my pom.xml:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycomp.mygroup</groupId>
<artifactId>special-persistence-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>1.0-SNAPSHOT</version>
<name>Special Persistence Plugin</name>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<excludes>
<exclude>**/SCCS/**/*.java</exclude>
</excludes>
<phase>compile</phase>
<goals>
<goal>compiler:compile</goal>
</goals>
</configuration>
</plugin>
</plugins>
</build>
</project>
Thank you to anyone with ideas about this,
-Denali
Actually, plugin:descriptor
is triggered during the generate-resources
phase which precedes compile
(see the lifecycle reference for a packaging of type maven-plugin
).
Anyway, the problem here is that regardless of the reason of the failure (even if the mojo had been able to parse p.STSMojo.java
that must contain some unexpected header, the plugin doesn't allow a Mojo to be present twice), the Maven Plugin Plugin doesn't support includes/excludes (see MPLUGIN-15 and go vote for it) and I'm not sure that you can solve this by configuration.
Maybe you can generate the plugin descriptor while the code is not under version control, put the descriptor in /META-INF/maven/plugin.xml
and configure the Maven plugin plugin to skip the descriptor generation. But I didn't test this.
Or maybe you could (clean or dirty) fix the plugin. But I didn't look at the source so I can't say much about this.
Or, and this is certainly not the expected answer but still the most simple, you could maybe use another VCS for your mojo (just for the Mojo, why not in parallel of bitkeeper).
I'd start with a comment on the Jira issue (your use case is perfectly valid and should be supported), you might get better ideas there.
精彩评论