Git Product home page Git Product logo

grails-maven's Introduction

Grails Maven Plugin

This is the Maven plugin for Grails. It provides the following Maven goals:

grails:console
grails:create-controller
grails:create-domain-class
grails:create-integration-test
grails:create-pom
grails:create-script
grails:create-service
grails:create-tag-lib
grails:create-unit-test
grails:exec
grails:generate-all
grails:generate-controller
grails:generate-views
grails:install-templates
grails:list-plugins
grails:package
grails:run-app
grails:run-app-https

As well as hooks into the normal Maven lifecyle like compile, package and test for Grails applications.

You can create an example POM with any Grails application by doing:

$ grails create-pom [GROUP ID]

Configuration

The maven grails plugin now supports any grails version. You can specify the grails version to use by setting the grailsVersion property in the section of the maven grails plugin:

<plugin>
    <groupId>org.grails</groupId>
    <artifactId>grails-maven-plugin</artifactId>
    <version>2.4.3</version>
    <configuration>
        <grailsVersion>2.3.10</grailsVersion>
        <!-- In the 2.4.3 release of grails-maven-plugin, you need to explicitly set the grailsVersion -->
        <!-- otherwise 2.4.2 will be used -->
        <!--<grailsVersion>2.4.3</grailsVersion>-->
    </configuration>
</plugin>

grails-maven's People

Contributors

akeffalas avatar apottere avatar bmcguire avatar bullpup avatar davidmc24 avatar dgrant avatar dsigurds avatar graemerocher avatar igosuki avatar jaypz avatar jbehmer avatar jdpgrailsdev avatar kovayur avatar labisso avatar mikethomsen avatar pledbrook avatar ryangardner avatar selera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grails-maven's Issues

Set working directory for tests in multi-module scenario

In a hierarchical multi-module project situation, when tests are executed on leaf-node modules, the current working directory is not being set to the directory of the leaf-node module being built.

This is the way maven/surefire works, and it seems to me that this maven plugin should do this for us too.

That way test cases can read/write files relative to the module that they belong to.

Any objections to me submitting a patch for this?

Grails 2.4.x breaks maven-based plugin builds

https://github.com/grails/grails-maven/blob/master/src/main/java/org/grails/maven/plugin/tools/DefaultGrailsServices.java#L141

The plugin is now calling out to a method called getClassNameForLowerCaseHyphenSeparatedName - that method is designed to take a class that is named like "foo-bar-baz" and turn it into "FooBarBaz".

The problem is that this is precisely the opposite of what used to happen at this line. It used to call out to GrailsNameUtils.getScriptName(GrailsNameUtils.getLogicalName(className, "GrailsPlugin"));

that method takes strings like "FooBarBaz" and turn it into "foo-bar-baz"

The net result of this change is that it wont pass the validator and gives strange errors to us as we try to run it.

Should I just copy the code that used to do the getScriptName method into this mojo?

Different groovy dependency version between grails 2.3.0 and grails-maven-plugin 2.3.0

When building war artefact via: mvn grails:war with grails 2.3.0, we have the following error at deployment time:

2013-10-21 17:04:17,108 driss-admin ERROR org.grails.plugin.resource.ResourceProcessor Unable to load resources
java.lang.IllegalStateException: Only 1 closure argument is accepted (args were: [bootstrap, bootstrap_utils])
    at org.grails.plugin.resource.module.ModulesBuilder.invokeMethod(ModulesBuilder.groovy:80)
    at ApplicationResources$_run_closure1_closure3.doCall(ApplicationResources.groovy:6)
    at ApplicationResources$_run_closure1.doCall(ApplicationResources.groovy:5)
    at org.grails.plugin.resource.ResourceProcessor$_loadModules_closure18.doCall(ResourceProcessor.groovy:719)
    at org.grails.plugin.resource.ResourceProcessor.loadModules(ResourceProcessor.groovy:713)
    at org.grails.plugin.resource.ResourceProcessor.reloadAll(ResourceProcessor.groovy:1006)
    at ResourcesGrailsPlugin$_closure3.doCall(ResourcesGrailsPlugin.groovy:165)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

The root cause seems to be a difference in version of groovy-all between the grails-maven-plugin (groovy 2.1.7) and grails cli (groovy 2.1.6).

We found that the class produce for ApplicationResources is different if you build it with grails cli and maven.

Workaround: As a workaround we forked the grails-maven-plugin to change its dependency from groovy-all-2.1.7 to groovy-all-2.1.6.

maven clean install goal failed

Environment:

 Grails 2.3.0, Maven 3.0.5, Windows 7, Command Line

Problem:

mvn clean install command fails. with the following error.

.....
|Environment set to test
|Compiling 10 source files
|Compiling 128 source files
|Running without daemon...
Log4j was not found on the classpath and will not be used for command line logging. Cause java.lang.NullPointerException: Cannot get property 'absolutePath' on null object
Error running forked test-app: org/slf4j/LoggerFactory (Use --stacktrace to see
the full trace)
Error | Forked Grails VM exited with error
[INFO] BUILD FAILURE

Steps to reproduce

 1. Open Command Prompt
 2. grails create-app testmaven
 3. cd testmaven
 4. grails create-pom com.example
 5. mvn clean install

and the build fails with the above mentioned error.

Note:

  Build Succeeds only when -DskipTests is set to true.
  mvn clean install -DskipTests=true  


  Thanks for releasing the grails-maven plugin 2.3.0.

Best practices and documentation.

Hi,

I'm trying to use the grails-maven-plugin in a project that has in their directory structure as follows:

src

  • main
  • - java
  • - groovy
  • - grails_app
  • - web_app

unfortunelly, for now fork it on modules is not an option, and the code need to be separated. I might be doing something wrong.

How ever gmaven a plugin that works for groovy allow me to do so.

any help?
how about to open a wiki?! :D

thanks

Grails firing find and save query when performing domain.save()

I have a piece of code in Grails2x with sql database. I have a table which is mapped to a domain. It was working fine with grails2x but as I update it to grails 3.2.9 , when I perform domain.save() it fires find query in hibernate and then update query and finally it fails.
Below I've attached error log:

org.springframework.orm.hibernate5.HibernateOptimisticLockingFailureException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; nested exception is org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

One more thing I will like to add for those table whose data type is varchar, domain.save() is working fine, but the table with column nvarchar type is giving above error.

Fork mode fails if java in the classpath is not JDK6+

When launching maven with JDK6+ set in JAVA_HOME and fork mode activated, the fork processes does not respect JAVA_HOME variable and use instead the first java binary in the classpath resulting in a error if the first java binary in the classpath is not JDK6+.

release:prepare, release:perform fails due to grails:validate

When running the ordinary mvn clean install etc - everything checks out. But when starting the release cycle with release:prepare - Things start to break:

[INFO] [ERROR] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] app.version [2.0.1-SNAPSHOT] in application.properties is different of the version [2.0.1] in the pom.xml
[INFO] [INFO] ------------------------------------------------------------------------

release:prepare updates the pom version and calls mvn clean - which again calls grails:validate which fails with

app.version [2.0.1-SNAPSHOT] in application.properties is different of the version [2.0.1] in the pom.xml

Here 2.0.1-SNAPSHOT is the version my project is at - the reason is that the pom version isn't synced to application.properties app.version. From what it looks like, you do this with app.grails.version?

Thanks for a great framework :-)

it does not compile with springframework 5.0.x or up

New springfrawework removed the class org.springframework.util.Log4jConfigurer. so the it failed when build the project.
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-maven-compile of goal org.grails:grails-maven-plugin:2.4.6:maven-compile failed: java.lang.ClassNotFoundEx ception: org.springframework.util.Log4jConfigurer
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.springframework.util.Log4jConfigurer
at org.grails.maven.plugin.tools.AbstractGrailsRuntime.createGrailsLauncher(AbstractGrailsRuntime.java:38)
at org.grails.maven.plugin.tools.DefaultGrailsRuntime.run(DefaultGrailsRuntime.java:17)
at org.grails.maven.plugin.AbstractGrailsMojo.runGrails(AbstractGrailsMojo.java:372)
at org.grails.maven.plugin.AbstractGrailsMojo.runGrails(AbstractGrailsMojo.java:334)
at org.grails.maven.plugin.MvnCompileMojo.execute(MvnCompileMojo.java:41)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 21 more
Caused by: java.lang.ClassNotFoundException: org.springframework.util.Log4jConfigurer
at org.grails.launcher.RootLoader.findClass(RootLoader.java:147)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.grails.launcher.RootLoader.loadClass(RootLoader.java:119)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.grails.maven.plugin.tools.AbstractGrailsRuntime.addLoggingJarsToRootLoader(AbstractGrailsRuntime.java:71)
at org.grails.maven.plugin.tools.AbstractGrailsRuntime.createGrailsLauncher(AbstractGrailsRuntime.java:36)

How to build standalone jetty app using grails-maven plugin?

I'd like my maven build of our grails app to produce a standalone jetty jar. I've been using the grails-standalone-plugin and that works great when building using the grails command line, but I can't figure out how I'd do a similar thing with maven and the grails-maven plugin. I'm wondering if it'd make sense to make the package target configurable so that it could run something other than "grails package". Any thoughts?

Integration Tests?

The current plugin only runs grails unit tests for binary plugins? Is there a reason why?

I have a lot of grails integration tests for my binary plugins that I want to run and I am upgrading my project to use this plugin.

It seems that we have:

  1. grails-app lifecycle:
    org.grails:grails-maven-plugin:maven-test
    org.grails:grails-maven-plugin:maven-functional-test

  2. grails-plugin and grails-binary-plugin lifecycle
    org.grails:grails-maven-plugin:maven-test

However:
a) the maven-test goal invokes only unit tests but does not invoke grails integration tests.

b) the maven-functional-test goal invokes unit, integration and functional

Why are poor old integration tests left out?

I can see that there is a tension between the structure and granularity of maven's life cycles and where grails does its testing. By default, grails combines unit and integration testing together in test-app where maven would by default do unit testing at the test goal, and integration testing at the integration-test goal. However, I don't see that tension as a reason to omit grails integration testing from the lifecycle.

Yes I can see that the default generated pom.xml uses surefire to run integration tests, but they will be plain old non-grails integration tests right? The grails environment won't be started up will it?

Error loading plugin manager: Could not create a new instance of class [org.codehaus.groovy.grails.plugins.web.mapping.UrlMappingsGrailsPlugin]

Using grails-maven-plugin version 2.4.4 I see the following error when trying to run:
mvn clean install -DskipTests=true or
mvn grails:run-app
See below for full error:
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for xxx.xxxxx:user-management:grails-plugin:0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 74, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building user-management 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- grails-maven-plugin:2.4.4:run-app (default-cli) @ user-management ---
|Loading Grails 2.4.4
|Configuring classpath
|Running pre-compiled script
.
|Environment set to development
.................................
|Packaging Grails application
.....................Error
|
Error loading plugin manager: Could not create a new instance of class [org.codehaus.groovy.grails.plugins.web.mapping.UrlMappingsGrailsPlugin]! (Use --stacktrace to see the full trace)

Executable JVM Param

Hello!

I am doing a migration from JDK 8 to JDK 17 in a project and trying to keep grails in JDK 8 so we can do it in parts. However grails plugin always use the JDK in JAVA_HOME. The maven compiler plugin let me set the JDK in the executable param, I wish I had the same in the grails plugin.

Dependency Resolution Error

Dependencies are being explicitly downloaded from Maven Central instead of specified maven repo. This is an issue for building on jenkins slaves without access to the external network.

This is using version 2.4.3

mvn grails:run-app fails

Environment:

 Grails 2.3.0, Maven 3.0.5, Windows 7, Command Line

Problem:

mvn grails:run-app command fails. with the following error.

Environment set to development
|Packaging Grails application
|Running Grails application
| Error java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
| Error at org.apache.commons.logging.impl.SLF4JLogFactory...156
| Error at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:
Could not find the main class: org.grails.plugins.tomcat.fork.ForkedTomcatServer
Program will exit.
Forked Grails VM exited with error

[INFO] BUILD FAILURE

Steps to reproduce

 1. Open Command Prompt
 2. grails create-app testmaven
 3. cd testmaven
 4. grails create-pom com.example
 5. mvn clean install -DskipTests=true
 6. mvn grails:run-app

and the build fails with the above mentioned error.

Grails 3 support

Are there any plans to update the plugin to the current grails major version?

Maven plugin issue

I'm not at a place where I can send you a pull request, so this is the best I can do. I found a bug in AbstractGrailsMojo.java around line 705. Your code is looking for the artifactId and groupId for groovy backward (artifact in the group, and vice versa):

Here's the corrected code:

String groupId = artifact.getGroupId();
String artifactId = artifact.getArtifactId();

if (groupId.equals("org.codehaus.groovy") &&
    (artifactId.equals("groovy-all") || artifactId.equals("groovy"))) {
        return artifact;
}

Otherwise, on Grails 2.4.2 it looks for Groovy 2.4.2.

Using own MANIFEST.MF file or adding dependencies with grails-maven-plugin

I am trying to convert a grails project from ant build to maven build and I am unable to add any dependencies to MANIFEST.MF file. Is there a way I can add dependencies to the MANIFEST.MF or use my own MANIFEST.MF file with grails-maven-plugin? I have tried to use the maven-resources-plugin for copying the file, but its not working. Any pointers on this would really help :)

Plugins in my pom.xml look like:

<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <compilerId>groovy-eclipse-compiler</compilerId>
        <source>${jdk.version}</source>
        <target>${jdk.version}</target>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-compiler</artifactId>
            <version>2.9.1-01</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-batch</artifactId>
            <version>2.3.7-01</version>
        </dependency>
    </dependencies>
</plugin>
<plugin>
    <groupId>org.grails</groupId>
    <artifactId>grails-maven-plugin</artifactId>
    <version>2.4.4</version>
    <configuration>
        <skipTests>true</skipTests>
        <fork>true</fork>
    </configuration>
    <extensions>true</extensions>
    <executions>
        <execution>
            <goals>
                <goal>clean</goal>
                <goal>maven-war</goal>
                <goal>validate</goal>
            </goals>
        </execution>
    </executions>
</plugin>
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <version>2.7</version>
    <configuration>
        <formats>
            <format>html</format>
            <format>xml</format>
        </formats>
    </configuration>
</plugin>
<plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.6</version>
    <configuration>
        <warSourceDirectory>web-app</warSourceDirectory>
        <failOnMissingWebXml>false</failOnMissingWebXml>
    </configuration>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.4.2</version>
    <executions>
        <execution>
            <id>default-copy-resources</id>
            <phase>process-resources</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <overwrite>true</overwrite>
                <outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/META-INF/</outputDirectory>
                <resources>
                    <resource>
                        <directory>${project.basedir}/src/META-INF</directory>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>

MANIFEST.MF generated by maven looks like

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.4
Created-By: 1.8.0_144-b01 (Oracle Corporation)
Import-Package: javax.servlet;version="[3.0,4.0)",javax.servlet.http;v
 ersion="[3.0,4.0)",javax.servlet.resources;version="[3.0,4.0)",javax.
 servlet.jsp;version="[2.2,3.0)";resolution:=optional,javax.servlet.js
 p.el;version="[2.2,3.0)";resolution:=optional,javax.servlet.jsp.jstl;
 version="[2.2,3.0)";resolution:=optional,javax.servlet.jsp.jstl.core;
 version="[2.2,3.0)";resolution:=optional,javax.servlet.jsp.jstl.fmt;v
 ersion="[2.2,3.0)";resolution:=optional,javax.servlet.jsp.jstl.sql;ve
 rsion="[2.2,3.0)";resolution:=optional,javax.servlet.jsp.jstl.tlv;ver
 sion="[2.2,3.0)";resolution:=optional,javax.servlet.jsp.tagext;versio
 n="[2.2,3.0)";resolution:=optional,javax.servlet.jsp.resources;versio
 n="[2.2,3.0)";resolution:=optional,javax.xml.parsers,org.w3c.dom,org.
 xml.sax,org.xml.sax.ext,org.xml.sax.helpers
Webapp-Context: empdet
Bundle-ClassPath: .,WEB-INF/classes,WEB-INF/lib/activation-1.1.jar,WEB
 -INF/lib/antlr-2.7.7.jar,WEB-INF/lib/aopalliance-1.0.jar,WEB-INF/lib/
 aspectjrt-1.8.2.jar,WEB-INF/lib/aspectjweaver-1.8.2.jar,WEB-INF/lib/c
 lassmate-1.0.0.jar,WEB-INF/lib/common-0.0.12.jar,WEB-INF/lib/commons-
 beanutils-1.9.1.jar,WEB-INF/lib/commons-codec-1.6.jar,WEB-INF/lib/com
 mons-collections-3.2.1.jar,WEB-INF/lib/commons-fileupload-1.3.1.jar,W
 EB-INF/lib/commons-httpclient-3.0.jar,WEB-INF/lib/commons-io-2.2.jar,
 WEB-INF/lib/commons-lang-2.6.jar,WEB-INF/lib/commons-lang3-3.2.1.jar,
 WEB-INF/lib/commons-validator-1.4.0.jar,WEB-INF/lib/concurrentlinkedh
 ashmap-lru-1.4.jar

Name: Grails Application
Implementation-Title: empdet
Implementation-Version: 0.0.1-SNAPSHOT
Grails-Version: 2.4.4

Along with this content in MANIFEST.MF, I also need to have the dependencies section as below

Dependencies: common,deployment.ValidationService.jar

mvn grails:run-app is'nt work

I've tried to use maven plugin 2.0.0.BUILD-SNAPSHOT for running Grails 2.0 project. After resolving some issues with plugin itself I've run application with mvn grails:run-app command and see that errors:
....

INFO] --- grails-maven-plugin:2.0.0.BUILD-SNAPSHOT:run-app (default-cli) @ maven-grails ---
[INFO] Using Grails 2.0.0
[INFO] Using Grails 2.0.0
| Configuring classpath
| Error log4j:WARN No appenders could be found for logger (org.springframework.core.io.support.PathMatchingResourcePatternResolver).
| Error log4j:WARN Please initialize the log4j system properly.
| Error log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
| Compiling 38 source files

| Running Grails application
| Error 2011-12-23 08:59:13,408 [Thread-6] ERROR context.ContextLoader - Context initialization failed
Message: org.springframework.beans.factory.xml.XmlBeanDefinitionReader.setEnvironment(Lorg/springframework/core/env/Environment;)V
Line | Method
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync


| 138 | run in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run in ''
^ 619 | run . . in java.lang.Thread

....

Looks like old Spring jars on classpath. But in maven deps there is no spring deps with version not 3.1.RELEASE.
In the same time mvn grails:run-war works fine. But how to effectively developing without run-app ?

Grails 2.2.4 execute mvn package occured exception

I used Grails 2.2.4 to build a web project, and I executed the command, grails create-pom to create a pom file, and everything went well. But currently, I added a local jar in lib directory, and I added a new element in pom, like:

<dependency>
<groupId>cn.eaglefire.app</groupId>
<artifactId>MsgComponent</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/MsgComponent-1.0.jar</systemPath>
</dependency>

when I executed " mvn -Dmaven.test.skip=true clean package " or " grails run-app ", an exception always came out and said " package XXX not exist ". And the exception is:

[ERROR] Failed to execute goal org.grails:grails-maven-plugin:2.2.4:maven-compile (default-maven-compile) on project MedicalConsult: Forked Grails VM exited with error -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.grails:grails-maven-plugin:2.2.4:maven-compile (default-maven-compile) on project MedicalConsult: Forked Grails VM exited with error
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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: Forked Grails VM exited with error
at org.grails.maven.plugin.AbstractGrailsMojo.runGrails(AbstractGrailsMojo.java:388)
at org.grails.maven.plugin.AbstractGrailsMojo.runGrails(AbstractGrailsMojo.java:308)
at org.grails.maven.plugin.MvnCompileMojo.execute(MvnCompileMojo.java:41)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.RuntimeException: Forked Grails VM exited with error
at org.grails.maven.plugin.tools.ForkedGrailsRuntime.fork(ForkedGrailsRuntime.java:117)
at org.grails.maven.plugin.AbstractGrailsMojo.runGrails(AbstractGrailsMojo.java:386)
... 23 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

Hope great geeks help me. Thanks.

Plugin should sync and validate the project.build.finalName property to app.name in application.properties app.name not project.name

In AbstractGrailsMojo.java the code sets the project.name as the app.name if not equal, then MvnValidateMojo.java validates that the project.artifactId equals the app.name. This does not allow you to set the project.name different than project.build.finalName or project.artifactId in the Maven pom.
The sync and validation should operate off the project.artifactId or project.build.finalName since according to section 9.2 Maven Properties of the Sonatype Maven: A Complete Reference "A project’s artifactId is often used as the name of a deliverable" where the project.name is described as "The name and project description can often be useful properties to reference from documentation".

Execution default-clean of goal org.grails:grails-maven-plugin:2.4.4:clean failed

Hi,

I can't use maven because of an error during clean.

To reproduce :

Java 8
Grails 2.5.0
New project

execute :
grails create-pom test

then :
mvn clean install package

the output :
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for test:test250:grails-app:0.1
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 160, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building test250 0.1
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.0 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.333 s
[INFO] Finished at: 2015-04-12T00:43:19+02:00
[INFO] Final Memory: 6M/240M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.0 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-clean-plugin:jar:2.4.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/PluginResolutionException

So I changed the maven-clean-plugin from 2.4.0 to 2.6.1

then execute :
mvn install package

the output :
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for test:test250:grails-app:0.1
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 160, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building test250 0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ test250 ---
[INFO]
[INFO] --- grails-maven-plugin:2.4.4:clean (default-clean) @ test250 ---
|Loading Grails 2.5.0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.294 s
[INFO] Finished at: 2015-04-12T08:37:50+02:00
[INFO] Final Memory: 23M/255M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.grails:grails-maven-plugin:2.4.4:clean (default-clean) on project test250: Execution default-clean of goal org.grails:grails-maven-plugin:2.4.4:clean failed: java.lang.reflect.InvocationTargetException: org.codehaus.groovy.runtime.DefaultGroovyMethods.each(Ljava/util/Collection;Lgroovy/lang/Closure;)Ljava/util/Collection; -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/PluginExecutionException

Is there a solution ?
Thanks

package-plugin fails because pom.xml created by create-pom on plugin project has missing tomcat dependency

Summary:

  • Grails 2.3.4
  • Gails plugin project
  • Use Maven
  • run "package-plugin" and get a class not found error.

Steps to reproduce:
grails create-plugin myplugin
cd myplugin
grails create-pom com.mycompany
mvn grails:package-plugin

Error output: https://gist.github.com/xnickmx/28036e21b862cf0a3b3d

To fix, add the Tomcat dependency to the POM.

    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>tomcat</artifactId>
        <version>7.0.47</version>
        <scope>provided</scope>
        <type>zip</type>
    </dependency>

By the way, this is the same dependency that IS added to Grails applications project POMs by "grails create-pom".

now mvn grails:package-plugin works.

Does this plugin copy jar file to WEB-INF/lib?

I have a Grails 2.0.3 project with maven.
I found an interesting phenomenon that this plugin (I guess, as I didn't find the cause) might copy other jar files to WEB-INF/lib after mvn package done.

For those machines which didn't config grails, the might happens.
For those machines which configs grails 2.0.3, this doesn't happen.

So I come to ask if this plugin has logic to check env variable like GRAILS_HOME?

The issue I encountered that when I tried to do maven install, it introduced two versions of slf4j, which leads to deployment error.

Multi-module POM - target/assets direectory is created in the project root

My maven project has multiple modules. One of them is a Grails project which uses the grails-maven-plugin. I noticed a difference between versions 2.4.4 and 2.4.3.

2.4.4 behavior - When mvn install tries to build the WAR file, the assets pipeline plugin tries to pre-compile the assets. These are put into $PROJECTROOT/target/assets instead of $PROJECTROOT/grailsModule/target/assets. Here's the relevant snippet from the build output:

|Building WAR file
........................................................................
|Precompiling Assets!
|Processing File 1 of 8 - bootstrap.min.js
|Compressing File 1 of 8 - bootstrap.min
|Processing File 2 of 8 - jquery.1.8.3.min.js
|Compressing File 2 of 8 - jquery.1.8.3.min
|Processing File 3 of 8 - bootstrap.min.css
|Compressing File 3 of 8 - bootstrap.min
|Processing File 4 of 8 - platformTools.css
|Minifying File 4 of 8 - platformTools
|Compressing File 4 of 8 - platformTools
|Processing File 5 of 8 - jquery.js
|Uglifying File 5 of 8 - jquery
|Compressing File 5 of 8 - jquery
|Processing File 6 of 8 - jquery/jquery-1.11.1.js
|Uglifying File 6 of 8 - jquery/jquery-1.11.1
|Compressing File 6 of 8 - jquery/jquery-1.11.1
|Processing File 7 of 8 - jquery/jquery-1.11.1.min.js
|Compressing File 7 of 8 - jquery/jquery-1.11.1.min
|Processing File 8 of 8 - jquery/jquery-1.11.1.min.map
|Compressing File 8 of 8 - jquery/jquery-1.11.1.min
|Finished Precompiling Assets
..Error
|
WAR packaging error: /path/to/project/grailsmodule/target/assets does not exist.

The directory target/assets is created in /path/to/project instead of /path/to/project/grailsmodule.

2.4.3 behavior - works fine.

I am using JDK 1.6, Grails 2.4.5, asset pipeline plugin version 1.9.9, and Maven 3.1.1. The behavior is the same for Windows and Linux builds.

Is there a work-around for this issue?

create-pom uses inexistent version of maven-clean-plugin

In Grails 2.5.6 when executing grails create-pom ... the pom generated includes a inexistent version of maven-clean-plugin.
It seems that there is an error in the file src/grails/templates/maven/project.pom which is the template for the pom file.

Compiling with maven a generated pom with Grails v2.5.0 it does not compile (but it does work with Grails v2.4.5)

$ mvn package

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.twintags:bpmn-webapp:grails-app:1.0
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 160, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building bpmn-webapp 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- grails-maven-plugin:2.4.4:validate (default-validate) @ bpmn-webapp ---
[INFO]
[INFO] --- grails-maven-plugin:2.4.4:init (default-init) @ bpmn-webapp ---
[INFO]
[INFO] --- grails-maven-plugin:2.4.4:config-directories (default-config-directories) @ bpmn-webapp ---
[INFO]
[INFO] --- grails-maven-plugin:2.4.4:maven-compile (default-maven-compile) @ bpmn-webapp ---
|Loading Grails 2.5.0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.182 s
[INFO] Finished at: 2015-04-22T16:52:26+02:00
[INFO] Final Memory: 23M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.grails:grails-maven-plugin:2.4.4:maven-compile (default-maven-compile) on project bpmn-webapp: Execution default-maven-compile of goal org.grails:grails-maven-plugin:2.4.4:maven-compile failed: java.lang.reflect.InvocationTargetException: org.codehaus.groovy.runtime.DefaultGroovyMethods.each(Ljava/util/Collection;Lgroovy/lang/Closure;)Ljava/util/Collection; -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/PluginExecutionException

mvn install fails with InvocationTargetException jline_.dll already loaded

After mavenizing a grails project I get the following when running mvn install:

...
[INFO] Surefire report directory: C:\efpi\workspaces\ehp\Efpi\Portal\portal\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
There are no tests to run.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- grails-maven-plugin:2.0.0:maven-test (default) @ portal ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.854s
[INFO] Finished at: Tue Jan 31 14:18:13 CET 2012
[INFO] Final Memory: 51M/92M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.grails:grails-maven-plugin:2.0.0:maven-test (default) on project portal: Unable to st
art Grails: java.lang.reflect.InvocationTargetException: Native Library C:\Users\jkj\AppData\Local\Temp\jline_.dl
l already loaded in another classloader -> [Help 1]

Any ideas?

/Jacob

NoClassDefFoundError: jline/CompletionHandler

Hi,

if I run the maven plugin with the following configuration I got a NoClassDefFoundError:

    <build>
        <plugins>
            <plugin>
                <groupId>org.grails</groupId>
                <artifactId>grails-maven-plugin</artifactId>
                <version>2.4.4</version>
                <configuration>
                    <grailsVersion>2.2.4</grailsVersion>
                </configuration>
            </plugin>
        </plugins>
    </build>
Caused by: java.lang.ClassNotFoundException: jline.CompletionHandler
    at org.grails.launcher.RootLoader.findClass(RootLoader.java:147)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at org.grails.launcher.RootLoader.loadClass(RootLoader.java:119)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 32 more

Regression introduce by pull-request #38 merge

The modification done with the pull-request #38 makes the build failed when running tests.

Plugins classes are no more included in classpath when running maven-test goal.
Reverting changes made in this pull-request make the build and tests succeed.

Build was OK when using 2.3.4 maven plugin.

Below is the stack trace obtained with the official 2.3.7 maven plugin:

Fatal error forking Grails JVM: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at org.grails.launcher.GrailsLauncher.launch(GrailsLauncher.java:150)
    at org.grails.maven.plugin.tools.ForkedGrailsRuntime.main(ForkedGrailsRuntime.java:168)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.grails.launcher.GrailsLauncher.launch(GrailsLauncher.java:144)
    ... 1 more
Caused by: java.lang.NoClassDefFoundError: KickstartResources
    at Config.run(Config.groovy:137)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
......
Caused by: java.lang.ClassNotFoundException: KickstartResources
    at org.grails.launcher.RootLoader.findClass(RootLoader.java:147)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at org.grails.launcher.RootLoader.loadClass(RootLoader.java:119)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 435 more

KickstartResources is a plugin class.

mvn grails:war does not include plugin resources/classes to the war file

We are trying to build our grails 2.3.0 project with maven but we can't manage to get plugins resources and classes in the generated war file.

Steps to reproduce:

  • grails create-app test
  • grails create-pom com.mycompany
  • mvn install or mvn grails:war

What we observed is:

  • in non fork mode, plugins are not compiled at all and everything produced files are directly under target directory
  • in fork mode, plugins seems to be compiled, every produced files are also directly under target folder

In both mode, plugins files are not included into the war

When doing grails war however, build files are not directly under target folder but under target/work/ and the war file does correctly contains the plugins files.

For information: we have tested it under maven 2 and maven 3 and JDK 7.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.