I'开发者_如何学运维ve added the maven-license-plugin
to my maven project which is setup in Eclipse. Now that its configured, I'm unable to find a way to execute it. Can anyone explain to me how you run this in eclipse ? thanks.
pom.xml file.
<plugin>
<groupId>com.google.code.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<header>header.txt</header>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Right click the project, Run As shows options for Maven assembly/build/clean/install/package/generate-sources/test/jar
-- i do not have any other options.
Attempted:
Setting up an external tool which I setup as ${maven_exec}
(configured in the preferences to be a String Substitution for mvn.bat
) with parameters license:format -Dyear=2011 -Demail=myaddress@mycompany.com
Result:
Buildfile: C:\dev\dependencies\maven\bin\mvn.bat
BUILD FAILED
C:\dev\dependencies\maven\bin\mvn.bat:1: Content is not allowed in prolog.
According to the documentation, the check goal binds by default to the verify stage of the maven build life cycle.
the default lifecycle has the following build phases (for a complete list of the build phases, refer to the Lifecycle Reference):
- validate - validate the project is correct and all necessary information is available
- compile - compile the source code of the project
- test - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
- package - take the compiled code and package it in its distributable format, such as a JAR.
- integration-test - process and deploy the package if necessary into an environment where integration tests can be run
- verify - run any checks to verify the package is valid and meets quality criteria
- install - install the package into the local repository, for use as a dependency in other projects locally
- deploy - done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
So you will need to run a build phase that has verify as a predecessor i.e. install or deploy.
Install is available on the maven run menu as you indicated above.
You select "run as > maven build ..." you will be prompted for which goal to execute where you can directly specify verify, and save this as a run configuration called project-verify.
Alternatively you can bind the check goal to a different life cycle phase, check the documentation link above for this config.
The plugin has the following goals:
check
(as seen here)format
(as seen here)remove
(as seen here)
Perhaps in Eclipse you could set these goals to run, but I would personally suggest running them through a console.
Select your project and then chose Run as and select build...
and then type your goals
for example in your case you can do :
license:check
license:format
license:remove
精彩评论