You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-users@incubator.apache.org by Eric Kolotyluk <er...@gmail.com> on 2014/04/08 14:24:13 UTC

Building an executable from modules

I am trying to figure out how to build an executable from modules. Does 
anyone have any example projects that do this.

I have a project with the following Maven modules:

csharp-windows-elevate
     elevate-common (dotnet-module)
     elevate-module (dotnet-module,depends on elevate-common)
     elevate-exe (dotnet-executable,depends on elevate-common and 
elevate-module)

When I try to compile I get

[INFO] csharp-windows-elevate ............................ SUCCESS [0.287s]
[INFO] elevate-common .................................... SUCCESS [2.543s]
[INFO] elevate-module .................................... SUCCESS [2.668s]
[INFO] elevate-exe ....................................... FAILURE [1.953s]

which fails because Maven is trying to compile elevate-exe when there is 
nothing to compile. In my POM I have

<plugin>
<groupId>org.apache.npanday.plugins</groupId>
<artifactId>maven-compile-plugin</artifactId>
<version>1.5.0-incubating-SNAPSHOT</version>
<extensions>true</extensions>
<executions>
<execution>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.npanday.plugins</groupId>
<artifactId>maven-link-plugin</artifactId>
<version>1.5.0-incubating-SNAPSHOT</version>
<extensions>true</extensions>
<configuration>
<frameworkVersion>4.0</frameworkVersion>
<parameters>
<parameter>/target:exe</parameter>
<parameter>/out:elevate.exe</parameter>
<parameter>/main:Elevate.Main</parameter>
</parameters>
</configuration>
</plugin>

But that does not seem to suppress the compiler, and it never gets to 
the linker.

Cheers, Eric

Re: Building an executable from modules

Posted by Eric Kolotyluk <er...@gmail.com>.
While I have since found another solution to my problem, in my research 
I learned that the way to suppress execution of a plugin was to use

<executions>
   <execution>
     <phase>none</phase>
   </execution>
</executions>

so I am wondering why that did not work. How should I override the 
execution of the maven-compile-plugin?

What does the maven-link-plugin do. Do you mean you have to add an 
explicit <execution> for it to work?

Cheers, Eric

On 4/10/2014 7:22 AM, Brett Porter wrote:
> On 9 Apr 2014, at 12:24 am, Eric Kolotyluk <er...@gmail.com> wrote:
>
>> I am trying to figure out how to build an executable from modules. Does anyone have any example projects that do this.
> I haven't tried this, but can notice a couple of things in the examples:
>
>>     elevate-exe (dotnet-executable,depends on elevate-common and elevate-module)
> This still has a lifecycle that includes compile, but not link:
>
> https://github.com/apache/npanday/blob/trunk/plugins/maven-compile-plugin/src/main/groovy/npanday/plugin/compile/CompileLifecycleMap.groovy#L66
>
> This means that:
>
>> <plugin>
>> <groupId>org.apache.npanday.plugins</groupId>
>> <artifactId>maven-compile-plugin</artifactId>
>> <version>1.5.0-incubating-SNAPSHOT</version>
>> <extensions>true</extensions>
>> <executions>
>> <execution>
>> <phase>none</phase>
>> </execution>
>> </executions>
>> </plugin>
> This is an additional execution, not an override.
>
>> <plugin>
>> <groupId>org.apache.npanday.plugins</groupId>
>> <artifactId>maven-link-plugin</artifactId>
>> <version>1.5.0-incubating-SNAPSHOT</version>
>> <extensions>true</extensions>
>> <configuration>
>> <frameworkVersion>4.0</frameworkVersion>
>> <parameters>
>> <parameter>/target:exe</parameter>
>> <parameter>/out:elevate.exe</parameter>
>> <parameter>/main:Elevate.Main</parameter>
>> </parameters>
>> </configuration>
>> </plugin>
> There is no execution for this configuration.
>
> Perhaps you need to use a bare lifecycle like the one from custom-lifecycle-plugin, add the link and attach the artifact?
>
> - Brett
>


Re: Building an executable from modules

Posted by Brett Porter <br...@apache.org>.
On 9 Apr 2014, at 12:24 am, Eric Kolotyluk <er...@gmail.com> wrote:

> I am trying to figure out how to build an executable from modules. Does anyone have any example projects that do this.

I haven't tried this, but can notice a couple of things in the examples:

>    elevate-exe (dotnet-executable,depends on elevate-common and elevate-module)

This still has a lifecycle that includes compile, but not link:

https://github.com/apache/npanday/blob/trunk/plugins/maven-compile-plugin/src/main/groovy/npanday/plugin/compile/CompileLifecycleMap.groovy#L66

This means that:

> <plugin>
> <groupId>org.apache.npanday.plugins</groupId>
> <artifactId>maven-compile-plugin</artifactId>
> <version>1.5.0-incubating-SNAPSHOT</version>
> <extensions>true</extensions>
> <executions>
> <execution>
> <phase>none</phase>
> </execution>
> </executions>
> </plugin>

This is an additional execution, not an override.

> <plugin>
> <groupId>org.apache.npanday.plugins</groupId>
> <artifactId>maven-link-plugin</artifactId>
> <version>1.5.0-incubating-SNAPSHOT</version>
> <extensions>true</extensions>
> <configuration>
> <frameworkVersion>4.0</frameworkVersion>
> <parameters>
> <parameter>/target:exe</parameter>
> <parameter>/out:elevate.exe</parameter>
> <parameter>/main:Elevate.Main</parameter>
> </parameters>
> </configuration>
> </plugin>

There is no execution for this configuration.

Perhaps you need to use a bare lifecycle like the one from custom-lifecycle-plugin, add the link and attach the artifact?

- Brett


AW: Building an executable from modules

Posted by Lars Corneliussen // Zen <me...@lcorneliussen.de>.
Well, I think if all you want is a simple exe, you are better off with just
using visual studio and run the build from there... or via msbuild.

NPanday is overkill then.

But it pays of for bigger projects :-)

-----Ursprüngliche Nachricht-----
Von: Eric Kolotyluk [mailto:eric.kolotyluk@gmail.com] 
Gesendet: Donnerstag, 10. April 2014 18:06
An: npanday-users@incubator.apache.org
Betreff: Re: Building an executable from modules

OK, after several days of intense, and I mean very intense, frustration,
here is what I have concluded:

http://kolotyluk.github.io/open-source/2014/04/09/hassling-dotnet.html

Because I know how to easily create an uber-jar assembly in Java, I falsely
concluded there was an equivalent way to do the same in .Net.

It is also compelling to want .Net software builds with NPanday to be
similar to Java software builds in Maven, but the reality is that there will
always be some serious differences in these processes. Still, my hope that
NPanday/Maven can increasingly reduce these differences in many areas, and I
look forward to a day where NPanday graduates from incubating to be fully
supported with the rest of Maven.

Cheers, Eric




AW: Building an executable from modules

Posted by Lars Corneliussen // Zen <me...@lcorneliussen.de>.
Also: There is no "living" equivalent to ueber-jar in .NET. Modules were
made for that, but they never actually got there - they are never linked to
and deployed separately.

People are using ILmerge for combining assemblies. But it also has
drawbacks. When a references b, and b is merged to c, there is no way you
can link a to b_in_c without recompiling... 

-----Ursprüngliche Nachricht-----
Von: Eric Kolotyluk [mailto:eric.kolotyluk@gmail.com] 
Gesendet: Donnerstag, 10. April 2014 18:06
An: npanday-users@incubator.apache.org
Betreff: Re: Building an executable from modules

OK, after several days of intense, and I mean very intense, frustration,
here is what I have concluded:

http://kolotyluk.github.io/open-source/2014/04/09/hassling-dotnet.html

Because I know how to easily create an uber-jar assembly in Java, I falsely
concluded there was an equivalent way to do the same in .Net.

It is also compelling to want .Net software builds with NPanday to be
similar to Java software builds in Maven, but the reality is that there will
always be some serious differences in these processes. Still, my hope that
NPanday/Maven can increasingly reduce these differences in many areas, and I
look forward to a day where NPanday graduates from incubating to be fully
supported with the rest of Maven.

Cheers, Eric




Re: Building an executable from modules

Posted by Eric Kolotyluk <er...@gmail.com>.
OK, after several days of intense, and I mean very intense, frustration, 
here is what I have concluded:

http://kolotyluk.github.io/open-source/2014/04/09/hassling-dotnet.html

Because I know how to easily create an uber-jar assembly in Java, I 
falsely concluded there was an equivalent way to do the same in .Net.

It is also compelling to want .Net software builds with NPanday to be 
similar to Java software builds in Maven, but the reality is that there 
will always be some serious differences in these processes. Still, my 
hope that NPanday/Maven can increasingly reduce these differences in 
many areas, and I look forward to a day where NPanday graduates from 
incubating to be fully supported with the rest of Maven.

Cheers, Eric



Re: Building an executable from modules

Posted by Brett Porter <br...@apache.org>.
On 10 Apr 2014, at 4:41 pm, Lars Corneliussen // Zen <me...@lcorneliussen.de> wrote:

> I have never tried that. Don't think anyone is maintaining it.
> I'd rather use dotnet-library and then at the end merge with ilmerge....
> 
> You could use the exec-plugin for that, allthough I'd like to have a
> maven-ilmerge-plugin.

What about:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-ilmerge-plugin/
?

- Brett


AW: Building an executable from modules

Posted by Lars Corneliussen // Zen <me...@lcorneliussen.de>.
I have never tried that. Don't think anyone is maintaining it.
I'd rather use dotnet-library and then at the end merge with ilmerge....

You could use the exec-plugin for that, allthough I'd like to have a
maven-ilmerge-plugin.

-----Ursprüngliche Nachricht-----
Von: Eric Kolotyluk [mailto:eric.kolotyluk@gmail.com] 
Gesendet: Dienstag, 8. April 2014 16:24
An: npanday-users@incubator.apache.org
Betreff: Building an executable from modules

I am trying to figure out how to build an executable from modules. Does
anyone have any example projects that do this.

I have a project with the following Maven modules:

csharp-windows-elevate
     elevate-common (dotnet-module)
     elevate-module (dotnet-module,depends on elevate-common)
     elevate-exe (dotnet-executable,depends on elevate-common and
elevate-module)

When I try to compile I get

[INFO] csharp-windows-elevate ............................ SUCCESS [0.287s]
[INFO] elevate-common .................................... SUCCESS [2.543s]
[INFO] elevate-module .................................... SUCCESS [2.668s]
[INFO] elevate-exe ....................................... FAILURE [1.953s]

which fails because Maven is trying to compile elevate-exe when there is
nothing to compile. In my POM I have

<plugin>
<groupId>org.apache.npanday.plugins</groupId>
<artifactId>maven-compile-plugin</artifactId>
<version>1.5.0-incubating-SNAPSHOT</version>
<extensions>true</extensions>
<executions>
<execution>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.npanday.plugins</groupId>
<artifactId>maven-link-plugin</artifactId>
<version>1.5.0-incubating-SNAPSHOT</version>
<extensions>true</extensions>
<configuration>
<frameworkVersion>4.0</frameworkVersion>
<parameters>
<parameter>/target:exe</parameter>
<parameter>/out:elevate.exe</parameter>
<parameter>/main:Elevate.Main</parameter>
</parameters>
</configuration>
</plugin>

But that does not seem to suppress the compiler, and it never gets to the
linker.

Cheers, Eric