You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by bi...@apache.org on 2014/06/27 04:33:12 UTC
svn commit: r1605941 - in /jena/trunk/jena-maven-tools: pom.xml
src/main/java/org/apache/jena/tools/schemagen/SchemagenMojo.java
src/test/resources/log4j.properties
Author: bimargulies
Date: Fri Jun 27 02:33:12 2014
New Revision: 1605941
URL: http://svn.apache.org/r1605941
Log:
JENA-731 JENA-732: make target for sources configurable, change default to add '/jena', and add the directory as a source root.
Added:
jena/trunk/jena-maven-tools/src/test/resources/log4j.properties (with props)
Modified:
jena/trunk/jena-maven-tools/pom.xml
jena/trunk/jena-maven-tools/src/main/java/org/apache/jena/tools/schemagen/SchemagenMojo.java
Modified: jena/trunk/jena-maven-tools/pom.xml
URL: http://svn.apache.org/viewvc/jena/trunk/jena-maven-tools/pom.xml?rev=1605941&r1=1605940&r2=1605941&view=diff
==============================================================================
--- jena/trunk/jena-maven-tools/pom.xml (original)
+++ jena/trunk/jena-maven-tools/pom.xml Fri Jun 27 02:33:12 2014
@@ -216,6 +216,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.2.1</version>
+ </dependency>
</dependencies>
<reporting>
<plugins>
Modified: jena/trunk/jena-maven-tools/src/main/java/org/apache/jena/tools/schemagen/SchemagenMojo.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-maven-tools/src/main/java/org/apache/jena/tools/schemagen/SchemagenMojo.java?rev=1605941&r1=1605940&r2=1605941&view=diff
==============================================================================
--- jena/trunk/jena-maven-tools/src/main/java/org/apache/jena/tools/schemagen/SchemagenMojo.java (original)
+++ jena/trunk/jena-maven-tools/src/main/java/org/apache/jena/tools/schemagen/SchemagenMojo.java Fri Jun 27 02:33:12 2014
@@ -39,9 +39,11 @@ import jena.schemagen.SchemagenOptions.O
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.DirectoryScanner;
import com.hp.hpl.jena.rdf.model.Resource;
@@ -61,9 +63,6 @@ public class SchemagenMojo
/* Constants */
/***********************************/
- /** Default output location */
- public static final String GENERATED_SOURCES = File.separator + "generated-sources";
-
/** Default pattern for includes */
/** Name of default options element */
@@ -77,13 +76,8 @@ public class SchemagenMojo
/* Instance variables */
/***********************************/
- /**
- * @parameter property="project.build.directory"
- */
-
- @Parameter(property="project.build.directory")
- private String projectBuildDir;
-
+ @Parameter(defaultValue = "${project.build.directory}/generated-sources/jena")
+ private String outputDirectory;
/**
* Array of file patterns to include in processing
@@ -109,12 +103,18 @@ public class SchemagenMojo
@Parameter(property="basedir")
private File baseDir;
+ @Component
+ private MavenProject project;
+
/** The default options object, if any */
private SchemagenOptions defaultOptions;
/** Map of source options, indexed by name */
private Map<String, SchemagenOptions> optIndex = new HashMap<>();
+ public SchemagenMojo() {
+ }
+
/***********************************/
/* Constructors */
/***********************************/
@@ -150,6 +150,7 @@ public class SchemagenMojo
for (String fileName: matchFileNames()) {
processFile( fileName );
}
+ project.addCompileSourceRoot( new File( outputDirectory ).getAbsolutePath() );
} catch (SchemagenOptionsConfigurationException e) {
throw new MojoExecutionException(
"Error during default schemagen options creation", e);
@@ -191,12 +192,7 @@ public class SchemagenMojo
return defaultOptions;
}
- /** Return the value of <code>${project.build.directory}</code> */
- public String getProjectBuildDir() {
- return projectBuildDir;
- }
-
- /**
+ /**
* Handle the default options by creating a default options object and assigning
* the options values from the given source object.
* @param defOptionsSource The source object containing the default options
@@ -350,7 +346,7 @@ public class SchemagenMojo
}
protected String getDefaultOutputDir(){
- return projectBuildDir + GENERATED_SOURCES;
+ return outputDirectory;
}
/***********************************/
Added: jena/trunk/jena-maven-tools/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/jena/trunk/jena-maven-tools/src/test/resources/log4j.properties?rev=1605941&view=auto
==============================================================================
--- jena/trunk/jena-maven-tools/src/test/resources/log4j.properties (added)
+++ jena/trunk/jena-maven-tools/src/test/resources/log4j.properties Fri Jun 27 02:33:12 2014
@@ -0,0 +1,25 @@
+ # Licensed to the Apache Software Foundation (ASF) under one
+ # or more contributor license agreements. See the NOTICE file
+ # distributed with this work for additional information
+ # regarding copyright ownership. The ASF licenses this file
+ # to you under the Apache License, Version 2.0 (the
+ # "License"); you may not use this file except in compliance
+ # with the License. You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+
+log4j.rootLogger=WARN, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+log4j.appender.A1.Encoding=UTF-8
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
\ No newline at end of file
Propchange: jena/trunk/jena-maven-tools/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jena/trunk/jena-maven-tools/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain