celerio-angular-quickstart
celerio-angular-quickstart copied to clipboard
SQLServer type DateTimeOffset is not supported
Error on generating using SqlServer (2016).
mvn -Pgen generate-sources -e -X
ERROR:
[INFO] Applying conventions...
[ERROR]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.573 s
[INFO] Finished at: 2017-05-16T18:26:04-04:00
[INFO] Final Memory: 26M/242M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jaxio.celerio:celerio-maven-plugin:4.0.17:generate (Generates files using the extracted database schema.) on project celerio-angular-quickstart: null: MojoExecutionException: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.jaxio.celerio:celerio-maven-plugin:4.0.17:generate (Generates files using the extracted database schema.) on project celerio-angular-quickstart: null
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException
at com.jaxio.celerio.maven.plugin.celerio.GenerateMojo.execute(GenerateMojo.java:204)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: java.lang.NullPointerException
at com.jaxio.celerio.model.support.AttributeSetup.getMappedTypeByGlobalMappingConfiguration(AttributeSetup.java:72)
at com.jaxio.celerio.model.support.AttributeSetup.getMappedType(AttributeSetup.java:54)
at com.jaxio.celerio.model.Attribute.getMappedType(Attribute.java:793)
at com.jaxio.celerio.model.Attribute.isString(Attribute.java:846)
at com.jaxio.celerio.factory.conventions.AccountConvention.setupAccount(AccountConvention.java:52)
at com.jaxio.celerio.factory.ProjectFactory.conventions(ProjectFactory.java:378)
at com.jaxio.celerio.factory.ProjectFactory.init(ProjectFactory.java:191)
at com.jaxio.celerio.main.CelerioProducer.produce(CelerioProducer.java:66)
at com.jaxio.celerio.main.CelerioProducer.produce(CelerioProducer.java:60)
at com.jaxio.celerio.maven.plugin.celerio.GenerateMojo.process(GenerateMojo.java:220)
at com.jaxio.celerio.maven.plugin.celerio.GenerateMojo.execute(GenerateMojo.java:201)
... 22 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
metadata.xml:
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.jaxio.com/schema/celerio">
<jdbcConnectivity driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://localhost" user="sa" password="tjmt2017" schemaName="dbo" oracleRetrieveRemarks="false" oracleRetrieveSynonyms="true" reverseIndexes="true" reverseOnlyUniqueIndexes="true" catalog="MyTrips">
<tableNamePatterns/>
<tableTypes>
<tableType>TABLE</tableType>
</tableTypes>
</jdbcConnectivity>
<databaseInfo databaseMajorVersion="13" databaseMinorVersion="0" databaseProductName="Microsoft SQL Server" databaseProductVersion="13.00.1601" driverMajorVersion="6" driverMinorVersion="0" driverName="Microsoft JDBC Driver 6.0 for SQL Server" driverVersion="6.0.8112.100" extraInfo=""/>
<tables>
<table name="Person" type="TABLE">
<columns>
<column name="Id" decimalDigits="0" autoIncrement="true" nullable="false" ordinalPosition="1" size="10" type="INTEGER"/>
<column name="Nome" decimalDigits="0" autoIncrement="false" nullable="false" ordinalPosition="2" size="10" type="NCHAR"/>
<column name="DataDeNascimento" decimalDigits="7" autoIncrement="false" nullable="false" ordinalPosition="3" size="34"/>
<column name="Sexo" decimalDigits="0" autoIncrement="false" nullable="true" ordinalPosition="4" size="10" type="NCHAR"/>
</columns>
<indexes>
<indexe columnName="Id" indexName="PK_Person" nonUnique="false"/>
</indexes>
<importedKeys/>
<primaryKeys>
<primaryKey>Id</primaryKey>
</primaryKeys>
</table>
</tables>
</metadata>
celerio-maven-plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<celerio xmlns="http://www.jaxio.com/schema/celerio" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jaxio.com/schema/celerio ./celerio.xsd">
<configuration rootPackage="com.mycompany.myapp" applicationName="sampleapp">
<!-- Which tables are used for generation -->
<tables>
<!-- <table include="false" pattern="*_AUDIT"/> -->
<table include="false" pattern="jhi_persistent_*"/>
</tables>
<!-- global number mapping (optional) -->
<numberMappings>
<numberMapping mappedType="M_BOOLEAN" columnSizeMin="1" columnSizeMax="2" columnDecimalDigitsMin="0"
columnDecimalDigitsMax="0"/>
<!-- <numberMapping mappedType="M_BIGDECIMAL" columnSizeMin="10" columnDecimalDigitsMin="4"/> -->
</numberMappings>
<!-- global date mapping (optional) -->
<dateMappings>
<!-- <dateMapping columnNameRegExp="VERSION" mappedType="M_UTILDATE"/> -->
<dateMapping columnJdbcType="TIMESTAMP" mappedType="M_LOCALDATETIME"/>
<dateMapping columnJdbcType="DATE" mappedType="M_LOCALDATE"/>
</dateMappings>
<headerComment>
<lines>
<line>Project home: https://github.com/jaxio/celerio-angular-quickstart</line>
<line></line>
<line>Source code generated by Celerio, an Open Source code generator by Jaxio.</line>
<line>Documentation: http://www.jaxio.com/documentation/celerio/</line>
<line>Source code: https://github.com/jaxio/celerio/</line>
<line>Follow us on twitter: @jaxiosoft</line>
<line>This header can be customized in Celerio conf...</line>
</lines>
</headerComment>
</configuration>
</celerio>
pom.xml:
<?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>
<groupId>com.jaxio</groupId>
<artifactId>celerio-angular-quickstart</artifactId>
<packaging>jar</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>celerio-angular-quickstart</name>
<description>
A Spring boot webbapp with Angular JS project generated by Celerio
</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
</parent>
<properties>
<!-- Explicitly declaring the source encoding eliminates the following message: -->
<!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
resources, i.e. build is platform dependent! -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- maven-compiler-plugin -->
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<hibernate.version>5.0.2.Final</hibernate.version>
<spring-security.version>4.0.4.RELEASE</spring-security.version>
<!-- ~~~~~~~~ -->
<!-- Database -->
<!-- ~~~~~~~~ -->
<!-- **** CHANGE THE PROPERTIES BELOW TO USE YOUR OWN DATABASE **** -->
<!-- **** DO NOT USE A PRODUCTION DATABASE **** -->
<!-- H2 DATABASE SETTINGS
<jdbc.groupId>com.h2database</jdbc.groupId>
<jdbc.artifactId>h2</jdbc.artifactId>
<jdbc.version>1.4.187</jdbc.version>
<jdbc.driver>org.h2.Driver</jdbc.driver>
<jdbc.url>jdbc:h2:${project.build.directory}/db/angular-lab;MVCC=TRUE;FILE_LOCK=NO</jdbc.url>
<jdbc.user>root</jdbc.user>
<jdbc.password>manager</jdbc.password>
<jdbc.schema></jdbc.schema>
<jdbc.catalog></jdbc.catalog>
<hibernate.dialect>org.hibernate.dialect.H2Dialect</hibernate.dialect>
<sql-maven-plugin.delimiter>;</sql-maven-plugin.delimiter>
<sql.create.script>01-create.sql</sql.create.script>
-->
<jdbc.groupId>com.microsoft.sqlserver</jdbc.groupId>
<jdbc.artifactId>sqljdbc42</jdbc.artifactId>
<jdbc.version>6.0</jdbc.version>
<jdbc.driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc.driver>
<jdbc.url>jdbc:sqlserver://localhost</jdbc.url>
<jdbc.user>sa</jdbc.user>
<jdbc.password>somepassword</jdbc.password>
<jdbc.schema>dbo</jdbc.schema>
<jdbc.catalog>MyTrips</jdbc.catalog>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Version dependencies when used in multiple dependencies -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<celerio-maven-plugin.outputDir>${project.basedir}</celerio-maven-plugin.outputDir>
<celerio-maven-plugin.version>4.0.17</celerio-maven-plugin.version>
<celerio-maven-plugin.configuration>../quickstart-conf/celerio-maven-plugin.xml</celerio-maven-plugin.configuration>
<celerio-maven-plugin.packs.configuration>../quickstart-conf/celerio-template-packs.xml</celerio-maven-plugin.packs.configuration>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Variables substituted in resources file at build time -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<application.name>${project.name}</application.name>
<application.version>${project.version}</application.version>
<application.description>${project.description}</application.description>
<!-- host port where the application will be deployed -->
<application.host>localhost</application.host>
<application.port>8080</application.port>
<application.contextpath>/demo</application.contextpath>
<!-- logs -->
<log.target>${project.build.directory}/logs</log.target>
<log.level>DEBUG</log.level>
<log.sql.queries.level>DEBUG</log.sql.queries.level>
<!-- hibernate, see by src/main/resource/hibernate.properties -->
<hibernate.show.sql>true</hibernate.show.sql>
<hibernate.format.sql>true</hibernate.format.sql>
<hibernate.generate_statistics>true</hibernate.generate_statistics>
<hibernate.use_sql_comments>true</hibernate.use_sql_comments>
<hibernate.ehcache.configuration.file>ehcache.xml</hibernate.ehcache.configuration.file>
<hibernate.use.second.level.cache>false</hibernate.use.second.level.cache>
<hibernate.use.query.cache>false</hibernate.use.query.cache>
<!-- use latest versions-->
<spring-data-releasetrain.version>Hopper-SR1</spring-data-releasetrain.version>
</properties>
<dependencies>
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${jdbc.artifactId}</artifactId>
<version>${jdbc.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-java8</artifactId>
<version>5.0.2.Final</version>
</dependency>
<!-- Celerio code completion support in velocity templates -->
<!-- See pack-angular/META-INF/velocity_implicit.vm -->
<dependency>
<groupId>com.jaxio.celerio</groupId>
<artifactId>celerio-engine</artifactId>
<version>${celerio-maven-plugin.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-data</artifactId>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.0.3</version>
</dependency>
<!-- ~~~~ -->
<!-- TEST -->
<!-- ~~~~ -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>spring-boot:run</defaultGoal>
<!-- Set the name of the war, used as the context root when the app
is deployed -->
<finalName>${project.artifactId}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>application.yml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>application.yml</exclude>
</excludes>
</resource>
<!-- COPY aot compilation results + aot index.html -->
<resource>
<directory>src/main/webapp/aot</directory>
<filtering>false</filtering>
<includes>
<include>index.html</include>
<include>dist/build.js</include>
<include>dist/build.js.map</include>
</includes>
<targetPath>static</targetPath>
</resource>
<!-- COPY other resources required by aot index.html -->
<resource>
<directory>src/main/webapp</directory>
<filtering>false</filtering>
<includes>
<include>node_modules/core-js/client/shim.min.js</include>
<include>node_modules/zone.js/dist/zone.min.js</include>
<include>node_modules/json.date-extensions/json.date-extensions.min.js</include>
<include>node_modules/primeng/resources/**</include>
<include>node_modules/@angular/material/core/theming/**</include>
</includes>
<targetPath>static</targetPath>
</resource>
</resources>
<testResources>
<testResource>
<directory>${celerio-maven-plugin.outputDir}/src/test/resources</directory>
<filtering>true</filtering>
</testResource>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>com.jaxio.celerio</groupId>
<artifactId>celerio-engine</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<!-- http://maven.apache.org/plugins/maven-resources-plugin/ -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
<delimiters>
<delimiter>@*@</delimiter>
</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>xls</nonFilteredFileExtension>
<nonFilteredFileExtension>xlsx</nonFilteredFileExtension>
<nonFilteredFileExtension>pdf</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
<plugin>
<!-- http://mojo.codehaus.org/build-helper-maven-plugin/ -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>Adding generated java folder to build</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/java</source>
<source>src/main/generated-java</source>
</sources>
</configuration>
</execution>
<execution>
<id>Adding generated java test location to test build</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/java</source>
<source>src/test/generated-java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<!-- Compiler plugin enforces Java compatibility and activates
annotation processors -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<!-- Profiles below are used when Celerio Maven Plugin is present in the build process -->
<profile>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Extract the database metadata -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<id>metadata</id>
<build>
<defaultGoal>generate-sources</defaultGoal>
<plugins>
<plugin>
<groupId>com.jaxio.celerio</groupId>
<artifactId>dbmetadata-maven-plugin</artifactId>
<version>${celerio-maven-plugin.version}</version>
<executions>
<execution>
<id>Extract the database schema.</id>
<goals>
<goal>extract-metadata</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${jdbc.artifactId}</artifactId>
<version>${jdbc.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Generate the code using Celerio -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<id>gen</id>
<build>
<defaultGoal>generate-sources</defaultGoal>
<plugins>
<plugin>
<groupId>com.jaxio.celerio</groupId>
<artifactId>celerio-maven-plugin</artifactId>
<version>${celerio-maven-plugin.version}</version>
<executions>
<execution>
<id>Generates files using the extracted database schema.</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Delete code generated by Celerio -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<id>cleanGen</id>
<build>
<plugins>
<plugin>
<groupId>com.jaxio.celerio</groupId>
<artifactId>celerio-maven-plugin</artifactId>
<version>${celerio-maven-plugin.version}</version>
<executions>
<execution>
<id>Delete previously generated files (use .celerio/ folder)</id>
<goals>
<goal>cleanGenerated</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Hi, thanks for this report. Have you changed manually metadata.xml ? (you should not). I think the NPE comes from the fact that "type" attribute is missing from the column DataDeNascimento...
Have you changed manually metadata.xml ? (you should not).
No. I didn't change the metadata.xml
.
I think the command to generate the metadata.xml mvn -Pmetadata generate-sources
didn't make it right then.
The SQLServer type is DateTimeOffset.
I changed the SQLServer type from DateTimeOffset to DateTime and executed again
mvn -Pmetadata generate-sources
then
mvn -Pgen generate-sources
and it works!
So, i guess the SQLServer type DateTimeOffset is not supported!