Ok ... so as the patch is allways removed, here it comes inline

Index: plugins/maven-exe-archiver-plugin/pom.xml
===================================================================
--- plugins/maven-exe-archiver-plugin/pom.xml   (revision 0)
+++ plugins/maven-exe-archiver-plugin/pom.xml   (working copy)
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<project
+        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";
+        xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.npanday.plugins</groupId>
+        <artifactId>maven-dotnet-plugins</artifactId>
+        <version>1.5.0-incubating-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.npanday.plugins</groupId>
+    <artifactId>maven-exe-archiver-plugin</artifactId>
+    <version>1.5.0-incubating-SNAPSHOT</version>
+
+    <name>NPanday :: Archiver :: 'Exe' Archiver Plugin</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-archiver</artifactId>
+            <version>1.1</version>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file
Index: 
plugins/maven-exe-archiver-plugin/src/main/java/npanday/plugin/archiver/PlexusIoExeResourceCollection.java
===================================================================
--- 
plugins/maven-exe-archiver-plugin/src/main/java/npanday/plugin/archiver/PlexusIoExeResourceCollection.java
  (revision 0)
+++ 
plugins/maven-exe-archiver-plugin/src/main/java/npanday/plugin/archiver/PlexusIoExeResourceCollection.java
  (working copy)
@@ -0,0 +1,37 @@
+package npanday.plugin.archiver;
+
+import 
org.codehaus.plexus.components.io.resources.PlexusIoCompressedFileResourceCollection;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: cdutz
+ * Date: 02.03.12
+ * Time: 12:04
+ */
+public class PlexusIoExeResourceCollection extends 
PlexusIoCompressedFileResourceCollection {
+
+    @Override
+    protected String getDefaultExtension() {
+        return ".exe";
+    }
+
+    @Override
+    protected InputStream getInputStream(File file) throws IOException {
+        // Simply return an InputStream to the resource file.
+        // This will make it embed the source as a whole.
+        return new FileInputStream(file);
+    }
+
+    @Override
+    public String getPath() {
+        // Without overriding this, the exe would be included with its full 
path.
+        // This way it is included directly in the root of the result archive.
+        return super.getFile().getName();
+    }
+
+}
\ No newline at end of file
Index: 
plugins/maven-exe-archiver-plugin/src/main/resources/META-INF/plexus/components.xml
===================================================================
--- 
plugins/maven-exe-archiver-plugin/src/main/resources/META-INF/plexus/components.xml
 (revision 0)
+++ 
plugins/maven-exe-archiver-plugin/src/main/resources/META-INF/plexus/components.xml
 (working copy)
@@ -0,0 +1,10 @@
+<component-set>
+    <components>
+        <component>
+              
<role>org.codehaus.plexus.components.io.resources.PlexusIoResourceCollection</role>
+              <role-hint>exe</role-hint>
+              
<implementation>npanday.plugin.archiver.PlexusIoExeResourceCollection</implementation>
+              <instantiation-strategy>per-lookup</instantiation-strategy>
+            </component>
+    </components>
+</component-set>
\ No newline at end of file
Index: plugins/pom.xml
===================================================================
--- plugins/pom.xml     (revision 1295495)
+++ plugins/pom.xml     (working copy)
@@ -58,6 +58,7 @@
     <module>netplugins/NPanday.Plugin.SysRef/javabinding</module>
     <module>netplugins/NPanday.Plugin.Msbuild/javabinding</module>
     <module>silverlight-maven-plugin</module>
+    <module>maven-exe-archiver-plugin</module>
   </modules>
   <dependencies>
     <dependency>


Chris





-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] 
Gesendet: Freitag, 2. März 2012 13:24
An: [email protected]
Betreff: AW: exe archiver for Maven assembly plugin?

Here goes again ...

-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] 
Gesendet: Freitag, 2. März 2012 13:01
An: [email protected]
Betreff: AW: exe archiver for Maven assembly plugin?

Hi,

Ok ... so I couldn't find anything in the NPanday Source, so I figgured out a 
solution on my own.
I applies the patch to NPanday to this mail. With this module I am able to 
create maven assemblies containing executables.

Here comes an example pom using this plugin (don't know if plugin is really the 
right name for it):

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0";
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>de.cware.utils</groupId>
        <artifactId>lib-psexec</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>

    <groupId>de.cware.utils</groupId>
    <artifactId>lib-psexec-client</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>de.cware.utils</groupId>
            <artifactId>lib-psexec-service</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <type>winexe</type>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.npanday.plugins</groupId>
                        <artifactId>maven-exe-archiver-plugin</artifactId>
                        <version>${npanday.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

</project>

The result is a Jar file containing all the classes of lib-psexec-client as 
well as the binary of lib-psexec-service embedded inside it. So it solved the 
problems I was having. I haven't done intense testing though as I simply wanted 
to embed exe files in my jars and this does the trick ;-)

Chris


-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] 
Gesendet: Freitag, 2. März 2012 10:40
An: [email protected]
Betreff: exe archiver for Maven assembly plugin?

Hi,

I am currently trying to setup a Maven build consisting of a mixed 
configuration (I am using 1.5-incubator-SNAPSHOT):

1.       Java Library (jar packaging)

2.       Windows Executable (winexe packaging)
The release should be a jar containing the Java library with an embedded exe 
(So I can load the binary from within my Java code)

When using the Maven assembly plugin, all I get is this:
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-assembly-plugin:2.2.1:single (make-assembly) on 
project lib-psexec-assembly: Failed to create assembly: Error adding file-set 
for 'de.cware.utils:lib-psexec-service:winexe:1.0.0-SNAPSHOT' to archive: Error 
adding archived file-set. PlexusIoResourceCollection not found for: 
C:\Maven-Repository\de\cware\utils\lib-psexec-service\1.0.0-SNAPSHOT\lib-psexec-service-1.0.0-SNAPSHOT.exe:
 No such archiver: 'exe'. -> [Help 1] So it seems there is no archiver 
available to handle exe resources.

So my question now is:
How do I configure the assembly to do this or is the such an assembler simply 
missing from NPanday and one should be implemented.

I would volunteer implementing one, if this would be the way to go, I just 
don't want to implement something that isn't needed.

Chris


[ C h r i s t o f e r  D u t z ]

C-Ware IT-Service
Inhaber
Dipl. Inf. Christofer Dutz
Karlstraße. 104, 64285 Darmstadt

fon:  0 61 51 / 27315 - 61
fax:  0 61 51 / 27315 - 64
mobil:  0171 / 7 444 2 33
email:  [email protected]<mailto:[email protected]>
http://www.c-ware.de<http://www.c-ware.de/>

UStId-Nr. DE195700962

Reply via email to