Revision
11511
Author
dantran
Date
2009-12-22 14:09:26 -0600 (Tue, 22 Dec 2009)
Log Message
MOJO-1448: use project.getCompileArtifacts() to include only compile
scope when searching for JNI interface
Modified Paths
trunk/mojo/maven-native/native-maven-plugin/src/it/jni/java/pom.xml
trunk/mojo/maven-native/native-maven-plugin/src/it/jni/native/win32/
pom.xml
trunk/mojo/maven-native/native-maven-plugin/src/it/jni/pom.xml
trunk/mojo/maven-native/native-maven-plugin/src/main/java/org/
codehaus/mojo/natives/plugin/NativeJavahMojo.java
trunk/mojo/maven-native/pom.xml
Property Changed
trunk/mojo/maven-native/
trunk/mojo/maven-native/native-maven-plugin/src/it/jni/java-win32/
Diff
Property changes: trunk/mojo/maven-native
Name: svn:ignore
- .classpath
.project
.metadata
+ .classpath
.project
.metadata
target
Modified: trunk/mojo/maven-native/native-maven-plugin/src/it/jni/
java/pom.xml (11510 => 11511)
--- trunk/mojo/maven-native/native-maven-plugin/src/it/jni/java/
pom.xml 2009-12-21 04:03:45 UTC (rev 11510)
+++ trunk/mojo/maven-native/native-maven-plugin/src/it/jni/java/
pom.xml 2009-12-22 20:09:26 UTC (rev 11511)
@@ -10,6 +10,7 @@
<groupId>org.codehaus.mojo.natives.it.jni</groupId>
<artifactId>hello</artifactId>
+
<name>JNI - Java </name>
Property changes: trunk/mojo/maven-native/native-maven-plugin/src/it/
jni/java-win32
Name: svn:ignore
+ target
Modified: trunk/mojo/maven-native/native-maven-plugin/src/it/jni/
native/win32/pom.xml (11510 => 11511)
--- trunk/mojo/maven-native/native-maven-plugin/src/it/jni/native/
win32/pom.xml 2009-12-21 04:03:45 UTC (rev 11510)
+++ trunk/mojo/maven-native/native-maven-plugin/src/it/jni/native/
win32/pom.xml 2009-12-22 20:09:26 UTC (rev 11511)
@@ -21,6 +21,14 @@
<artifactId>hello</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
+
+ <!-- just here to test MOJO-1448 -->
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.6</version>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
Modified: trunk/mojo/maven-native/native-maven-plugin/src/it/jni/
pom.xml (11510 => 11511)
--- trunk/mojo/maven-native/native-maven-plugin/src/it/jni/pom.xml
2009-12-21 04:03:45 UTC (rev 11510)
+++ trunk/mojo/maven-native/native-maven-plugin/src/it/jni/pom.xml
2009-12-22 20:09:26 UTC (rev 11511)
@@ -8,9 +8,22 @@
<packaging>pom</packaging>
+
<modules>
<module>java</module>
<module>native</module>
</modules>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>native-maven-plugin</artifactId>
+ <version>1.0-alpha-4-SNAPSHOT</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
</project>
Modified: trunk/mojo/maven-native/native-maven-plugin/src/main/java/
org/codehaus/mojo/natives/plugin/NativeJavahMojo.java (11510 => 11511)
--- trunk/mojo/maven-native/native-maven-plugin/src/main/java/org/
codehaus/mojo/natives/plugin/NativeJavahMojo.java 2009-12-21
04:03:45 UTC (rev 11510)
+++ trunk/mojo/maven-native/native-maven-plugin/src/main/java/org/
codehaus/mojo/natives/plugin/NativeJavahMojo.java 2009-12-22
20:09:26 UTC (rev 11511)
@@ -2,26 +2,23 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004, The Codehaus
- *
- * Permission is hereby granted, free of charge, to any person
obtaining a copy of
- * this software and associated documentation files (the
"Software"), to deal in
- * the Software without restriction, including without limitation
the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/
or sell copies
- * of the Software, and to permit persons to whom the Software is
furnished to do
- * so, subject to the following conditions:
*
- * The above copyright notice and this permission notice shall be
included in all
- * copies or substantial portions of the Software.
+ * Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and
+ * associated documentation files (the "Software"), to deal in the
Software without restriction,
+ * including without limitation the rights to use, copy, modify,
merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
*
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE
- * SOFTWARE.
+ * The above copyright notice and this permission notice shall be
included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT
+ * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
import org.apache.maven.project.MavenProject;
@@ -43,7 +40,6 @@
import java.io.IOException;
import java.io.File;
-import java.util.Set;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
@@ -80,7 +76,7 @@
private String[] classNames;
/**
- * Path to javah executable, if present, it will overide the
default one which bases on architecture type. See 'implementation'
argument
+ * Path to javah executable, if present, it will override the
default one which bases on architecture type. See 'implementation'
argument
* @parameter
* @optional
*/
@@ -100,7 +96,7 @@
*
*/
protected File workingDirectory;
-
+
/**
* Generated native source files go here
* @parameter default-value="${project.build.directory}/native/
javah"
@@ -131,7 +127,7 @@
private JavahManager manager;
/**
- * For unittest only
+ * For unit test only
*/
private JavahConfiguration config;
@@ -179,28 +175,30 @@
{
List list = new ArrayList();
- Set artifacts = this.project.getDependencyArtifacts();
+ List artifacts = this.project.getCompileArtifacts();
- for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
+ if ( artifacts != null )
{
- Artifact artifact = (Artifact) iter.next();
-
- //pick only jar files
- if ( ! "jar".equals( artifact.getType() ) )
+
+ for ( Iterator iter = artifacts.iterator(); iter.hasNext
(); )
{
- continue;
+ Artifact artifact = (Artifact) iter.next();
+
+ //pick up only jar files
+ if ( !"jar".equals( artifact.getType() ) )
+ {
+ continue;
+ }
+
+ //exclude some other scopes
+ if ( Artifact.SCOPE_PROVIDED.equals
( artifact.getScope() ) )
+ {
+ continue;
+ }
+
+ list.add( artifact );
+
}
-
- //exclude some other scopes
- if ( Artifact.SCOPE_PROVIDED.equals( artifact.getScope
() ) ||
- Artifact.SCOPE_TEST.equals( artifact.getScope() )
- )
- {
- continue;
- }
-
- list.add( artifact );
-
}
return list;
@@ -289,7 +287,7 @@
}
catch ( IOException ioe )
{
- throw new MojoExecutionException( "Error searching
for native class in " + artifact.getFile() , ioe );
+ throw new MojoExecutionException( "Error searching
for native class in " + artifact.getFile(), ioe );
}
}
Modified: trunk/mojo/maven-native/pom.xml (11510 => 11511)
--- trunk/mojo/maven-native/pom.xml 2009-12-21 04:03:45 UTC (rev
11510)
+++ trunk/mojo/maven-native/pom.xml 2009-12-22 20:09:26 UTC (rev
11511)
@@ -2,8 +2,9 @@
<parent>
<artifactId>mojo-parent</artifactId>
<groupId>org.codehaus.mojo</groupId>
- <version>21</version>
+ <version>23</version>
</parent>
+
<modelVersion>4.0.0</modelVersion>
<groupId>org.codehaus.mojo.natives</groupId>
<artifactId>maven-native</artifactId>
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email