Oleg, see below to the pom
Here are some main points:
- The provider is aware of /c /Fo /OUT ( output flags)
- I removed /c and /Fo flags, msvc provider is aware of this flag
- I removed /Include . It includes automatically add it since you already
define it in source configuration
- I remove /out flag in linker option, the provider is ware of this flag,
I added /lib to tell linker it is a static lib build
- remove ${basedir}, not needed, maven is aware of this
- you need to use the right envFactory for VS.NET, you have msvc6. What
do you have?
- The NPE is possibibly from empty source element, i will try to produce
and add test cases
- Please check out the source code in SVN for see example
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bmc.txm.common.transport</groupId>
<artifactId>txm-transport-c2j-socket-lib</artifactId>
<packaging>lib</packaging>
<version>1.0-SNAPSHOT</version>
<name>TXM Transport C Socket Library</name>
<url>http://maven.apache.org</url>
<dependencies>
<!-- there is no dependencies - stabdalone static C library -->
</dependencies>
<build>
<plugins>
<!--
http://mojo.codehaus.org/maven-native/native-maven-plugin/introduction.html-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<compilerProvider>msvc</compilerProvider>
<!-- setup compiler/link environment according to msvc 6
vcvars32.bat
-->
<!-- without this setting, you will need to setup the environment out
side of Maven -->
<envFactoryName>org.codehaus.mojo.natives.msvc.MSVC6EnvFactory
</envFactoryName>
<compilerStartOptions>
<compilerStartOption>
/O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /EHsc /MD /GS
/W3 /nologo /Wp64 /Zi /TP
</compilerStartOption>
</compilerStartOptions>
<sources>
<source>
<directory>Src</directory>
<fileNames>
<fileName>AnywareSocket.cpp</fileName>
</fileNames>
</source>
<!-- additional include path -->
<source>
<directory>../Include </directory>
</source>
<linkerStartOptions>
<linkerStartOption> /lib </linkerStartOption>
</linkerStartOptions>
</configuration>
</plugin>
</plugins>
</build>
</project>
On 3/12/06, Fraimovich, Oleg <[EMAIL PROTECTED]> wrote:
>
> Hi Dan,
>
> As far as I understand you are developer of the plug-in. It would be very
> kind of to advice me.
>
> I'm Java developer that must to build C++ static library under windows. I
> developed it using .NET Visual Studio. While I run maven (see the pom
> attached) I get the following output.
>
> Could you please advice what I missed.
>
>
>
> Thanks a lot in advance.
>
>
>
> P:\p4client\projects\infrastructure\transport\dev\txm-transport-c2j\AnywareSocket>mvn
> compile
>
> Listening for transport dt_socket at address: 5025
>
> [INFO] Scanning for projects...
>
> [INFO]
> ----------------------------------------------------------------------------
>
> [INFO] Building TXM Transport C Socket Library
>
> [INFO] task-segment: [compile]
>
> [INFO]
> ----------------------------------------------------------------------------
>
> [INFO] [native:compile]
>
> [INFO]
> ----------------------------------------------------------------------------
>
> [ERROR] FATAL ERROR
>
> [INFO]
> ----------------------------------------------------------------------------
>
> [INFO] null
>
> [INFO]
> ----------------------------------------------------------------------------
>
> [INFO] Trace
>
> java.lang.NullPointerException
>
> at
> org.codehaus.mojo.natives.compiler.AbstractCCompiler.getCommandLine(
> AbstractCCompiler.java:83)
>
> at org.codehaus.mojo.natives.msvc.MSVCCompiler.getCommandLine(
> MSVCCompiler.java:73)
>
> at org.codehaus.mojo.natives.compiler.AbstractCompiler.compile(
> AbstractCompiler.java:74)
>
> at org.codehaus.mojo.natives.plugin.NativeCompileMojo.execute(
> NativeCompileMojo.java:162)
>
> at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
> DefaultPluginManager.java:415)
>
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> DefaultLifecycleExecutor.java:531)
>
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
> (DefaultLifecycleExecutor.java:47
>
> 2)
>
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> (DefaultLifecycleExecutor.java:451)
>
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
> (DefaultLifecycleExecutor.jav
>
> a:303)
>
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
> DefaultLifecycleExecutor.java:270)
>
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
> DefaultLifecycleExecutor.java:139)
>
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
>
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
>
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
>
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
>
> at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java
> :315)
>
> at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>
> at org.codehaus.classworlds.Launcher.mainWithExitCode(
> Launcher.java:430)
>
> at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>
> [INFO]
> ----------------------------------------------------------------------------
>
> [INFO] Total time: 3 seconds
>
> [INFO] Finished at: Sun Mar 12 16:11:29 IST 2006
>
> [INFO] Final Memory: 3M/6M
>
> [INFO]
> ----------------------------------------------------------------------------
>
>
>
>
> *Oleg Fraimovich*
>
> Technical Lead
>
> BMC Software Inc. Tel-Aviv
>
> office: +972-3-76745344
>
>
>
>
>
>