Permalink
Browse files

clean up and readme file

  • Loading branch information...
1 parent 8ada111 commit 9ead9475abe0487d85621b916261a303b7accbf1 @sclasen sclasen committed Jan 18, 2011
Showing with 82 additions and 16 deletions.
  1. +8 −0 .gitignore
  2. +70 −0 readme.md
  3. +3 −16 src/main/java/com/force/maven/plugin/ForceMojo.java
  4. +1 −0 src/test/resources/testForceScript.fs
View
@@ -0,0 +1,8 @@
+.classpath
+.settings
+.project
+target
+*.ipr
+*.iml
+*.iws
+
View
@@ -0,0 +1,70 @@
+#maven-vmforce-plugin
+
+This is a maven plugin that lets you execute cliforce scripts as part of your maven build.
+
+It can be used to set up before and tear down after functional tests run by maven, or for any other purpose for which you
+can use a force script.
+
+##configuration
+
+Here is an example configuration that could be added to your pom.xml to cause a force script to be executed
+before tests are run.
+
+ <plugin>
+ <groupId>com.force.maven.plugin</groupId>
+ <artifactId>maven-vmforce-plugin</artifactId>
+ <configuration>
+ <forceScript>target/test-classes/cleanAndSetupTestEnv.fs</forceScript>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>force</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+##using maven resource filtering on scripts
+
+If you configure your maven pom.xml correctly you can use maven resource filtering on script files.
+
+For instance if you would like to have your webapp deployed every time you do a build, you could place the following line
+in src/test/resources/deploy.fs
+
+ push -n ${project.artifactId} -p target/${project.artifactId}-${project.version}.${project.packaging}
+
+and then configure your pom.xml to do filtering on that directory.
+
+ <build>
+ ...
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ ...
+ </build>
+
+In this way you wont have to update the script anytime your project version changes.
+
+###plugin group
+
+To make this plugin easy to use via the command line you should add com.force.maven.plugin as a plugin group
+to your maven settings.xml
+
+ <pluginGroups>
+ ...
+ <pluginGroup>com.force.maven.plugin</pluginGroup>
+ ...
+ </pluginGroups>
+
+This will shorten the command you have to type from
+
+ mvn com.force.maven.plugin:maven-vmforce-plugin:force -Dforce.script=path/to/script
+
+to
+
+ mvn vmforce:force -Dforce.script=path/to/script
@@ -1,20 +1,5 @@
package com.force.maven.plugin;
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import com.force.cliforce.CLIForce;
import com.force.cliforce.ForceEnv;
@@ -74,7 +59,9 @@ public void execute()
}
} else {
- getLog().error(String.format("forceScript file: %s does not exist", forceScript.getAbsolutePath()));
+ String msg = String.format("forceScript file: %s does not exist", forceScript.getAbsolutePath());
+ getLog().error(msg);
+ throw new MojoExecutionException(msg);
}
}
}
@@ -2,6 +2,7 @@ plugin -a cliplugin -v 1.0
cliplugin:hello
unplug cliplugin
help ${plugin}
+help ${project.artifactId}-${project.version}.${project.packaging}
list
apps
exit

0 comments on commit 9ead947

Please sign in to comment.