Skip to content

Commit

Permalink
Merge pull request #7 from hgschmie/master
Browse files Browse the repository at this point in the history
Allow deployment of the executable through maven repos.
  • Loading branch information
hgschmie committed Jul 23, 2014
2 parents 913bd85 + baacf68 commit 10570e0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -3,7 +3,7 @@

<groupId>org.skife.maven</groupId>
<artifactId>really-executable-jar-maven-plugin</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>

<name>Really Executable Jar Maven Plugin</name>
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/org/skife/waffles/MyMojo.java
Expand Up @@ -4,6 +4,7 @@
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.apache.maven.project.artifact.AttachedArtifact;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
Expand Down Expand Up @@ -33,6 +34,13 @@ public class MyMojo extends AbstractMojo
*/
private MavenProject project;

/**
* @component
* @required
* @readonly
*/
private MavenProjectHelper projectHelper;

/**
* The greeting to display.
*
Expand All @@ -54,6 +62,20 @@ public class MyMojo extends AbstractMojo
*/
private String classifier;

/**
* Attach the binary as an artifact to the deploy.
*
* @parameter
*/
private boolean attachProgramFile = false;

/**
* File ending of the program artifact.
*
* @parameter
*/
private String programFileType = "sh";

/**
*
* @parameter
Expand Down Expand Up @@ -87,6 +109,9 @@ public void execute() throws MojoExecutionException
File exec = new File(dir, programFile);
FileUtils.copyFile(file, exec);
makeExecutable(exec);
if (attachProgramFile) {
projectHelper.attachArtifact(project, programFileType, exec);
}
}
} else {
for (File file : files) {
Expand Down

0 comments on commit 10570e0

Please sign in to comment.