I am writing my groovy code in maven using GMaven plugin. when I do mvn clean install it is showing build success but when I checked my target folder it is not generating any jar for me. I am refering this atlassian link in that
<plugins>
<plugin>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
but for this I am getting pom error on execution. please help me out here
Below is my pom file
<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.myproject</groupId>
<artifactId>mydata</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mydata</name>
<url>http://maven.apache.orgurl>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<gmaven.version>1.5</gmaven.version>
<groovy.version>2.1.8</groovy.version>
</properties>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.11</version>
</dependency>
</dependencies>
<build>
<!-- <pluginManagement> -->
<plugins>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>${gmaven.version}</version>
<configuration>
<providerSelection>2.0</providerSelection>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-2.0</artifactId>
<version>${gmaven.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
</dependency>
</dependencies>
<!-- <executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions> -->
</plugin>
</plugins>
<!-- </pluginManagement> -->
</build>
</project>
UPDATE 1:
I am able to see the jar but it does not have my groovy code
Can you please try the following:
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>addSources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<sources>
<source>
<directory>${project.basedir}/src</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</source>
</sources>
</configuration>
</plugin>
Actually that's what I'm using and jar is correctly generated
PS: Make sure that source.directory points to where your .groovy files exist
Related
I have some Avro files using custom Logical Types. When I try to build my project using mvn clean install in order to generate automatically my Java classes. I've tried the following example of the implementation of Street type (https://github.com/markush81/avro-examples). I get the following error :
Failed to execute goal org.apache.avro:avro-maven-plugin:1.11.0:schema (schemas) on project atlas_v: Error compiling protocol file to project\src\main\java
Here is my pom.xml below :
<?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.vadis</groupId>
<artifactId>atlas_v</artifactId>
<version>1.2</version>
<properties>
<java.version>1.8</java.version>
<atlas.version>2.0.0</atlas.version>
<avro.version>1.11.0</avro.version>
<spark.version>3.0.1</spark.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<distributionManagement>
<repository>
<id>gitlab-atlas</id>
<!--suppress UnresolvedMavenProperty -->
<url>${CI_API_V4_URL}/projects/${env.CI_PROJECT_ID}/packages/maven</url>
</repository>
<snapshotRepository>
<id>gitlab-atlas</id>
<!--suppress UnresolvedMavenProperty -->
<url>${CI_API_V4_URL}/projects/${env.CI_PROJECT_ID}/packages/maven</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
.......
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>${avro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-common</artifactId>
<version>${atlas.version}</version>
</dependency>
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-client-v2</artifactId>
<version>${atlas.version}</version>
</dependency>
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-client-v1</artifactId>
<version>${atlas.version}</version>
</dependency>
.... dependencies
</dependencies>
<build>
<plugins>
.... others plugins
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>${avro.version}</version>
<executions>
<execution>
<id>schemas</id>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
<goal>protocol</goal>
<goal>idl-protocol</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDirectory>${project.basedir}/src/main/resources/</sourceDirectory>
<outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
<enableDecimalLogicalType>true</enableDecimalLogicalType>
<customConversions>
<customConversion>com.vadis.atlas_v.model.avro.utils.StreetConversion</customConversion>
</customConversions>
<customLogicalTypeFactories>
<customLogicalTypeFactory>com.vadis.atlas_v.model.avro.utils.StreetLogicalTypeFactory</customLogicalTypeFactory>
</customLogicalTypeFactories>
</configuration>
</plugin>
</plugins>
</build>
</project>
I had this exact same error. My issue was that the .java source files that Avro was compiling to already existed and were owned by another user.
I have an app that consists of two main modules: backend and frontend.
Backend is written in SpringBoot, with SpringMVC.
Frontend is Angular.
I would like to build the app and for all the frontend paths to have a prefix "/app-frontend" so that I can easily ignore them from the SpringBoot security configurations. How can I achieve this? What I have until now is the following:
fronent 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">
<parent>
<groupId>com.demo.app</groupId>
<artifactId>demo-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>demo-app-frontend</artifactId>
<packaging>jar</packaging>
<build>
<resources>
<resource>
<!-- we copy the content of the frontend directory in the final artifact -->
<directory>./dist/demo-app-frontend</directory>
<targetPath>static</targetPath>
</resource>
</resources>
<plugins>
<!-- clean the dist directory used by Angular -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<filesets>
<fileset>
<directory>dist</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.11.2</version>
<configuration>
<workingDirectory>./</workingDirectory>
<nodeVersion>v14.18.0</nodeVersion>
<npmVersion>6.14.15</npmVersion>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run pipeline-build</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
backend pom.xml:
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>demo-app-frontend</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>
</dependencies>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>merge</id>
<phase>initialize</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.demo.app</groupId>
<artifactId>demo-app-frontend</artifactId>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
The build passes and I can start UI by running the jar and accessing localhost:8080 but I do not know what changes I need to do for the UI to be accessible at localhost:8080/frontend-app
Within a larger Maven project, I have a Java file (AudioFileBuilder.java) that generates audio files from the Google Cloud Text-to-Speech service. It can execute from its own main() class; however, this file references an enumeration within the project (that other project source files depend on).
I am creating a fat JAR (JAR-with-dependencies), .exe file (Windows), and .app file (macOS) for the main project. I would like to exclude the AudioFileBuilder.java file AND the associated Google Cloud Text-to-Speech dependency in the JAR, exe, and app files. However, I still need the AudioFileBuilder.java file to run every time the project is built.
Here is a link to my project's current POM file (the project is open-source):
https://github.com/hadi16/GamesForTheBlind/blob/Alex-Branch/pom.xml
This is my current POM file:
<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>edu.up</groupId>
<artifactId>Games_For_Blind</artifactId>
<version>1.0.0.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<packaging>jar</packaging>
<dependencies>
<!-- Compile Dependencies -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-texttospeech</artifactId>
<version>0.117.0-beta</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
<scope>compile</scope>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>12</source>
<target>12</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<outputDirectory>${project.build.directory}/dist</outputDirectory>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>gamesforblind.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-classes</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target/xsd-out</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- To generate the phrase audio files. -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>gamesforblind.synthesizer.AudioFileBuilder</argument>
</arguments>
<environmentVariables>
<GOOGLE_APPLICATION_CREDENTIALS>google_api_key.json</GOOGLE_APPLICATION_CREDENTIALS>
</environmentVariables>
</configuration>
</plugin>
<!-- Create executable Windows file. -->
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.7.25</version>
<executions>
<execution>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<jar>${project.build.directory}/dist/${project.artifactId}-${project.version}-jar-with-dependencies.jar</jar>
<outfile>${project.build.directory}/dist/${project.artifactId}-${project.version}.exe</outfile>
<classPath>
<mainClass>gamesforblind.Main</mainClass>
</classPath>
<jre>
<minVersion>12</minVersion>
<jdkPreference>preferJre</jdkPreference>
</jre>
<versionInfo>
<copyright>2019</copyright>
<fileVersion>${project.version}</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>${project.name}</fileDescription>
<productVersion>${project.version}</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>${project.name}</productName>
<internalName>${project.name}</internalName>
<originalFilename>${project.artifactId}-${project.version}.exe</originalFilename>
<companyName>University of Portland</companyName>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>de.perdian.maven.plugins</groupId>
<artifactId>macosappbundler-maven-plugin</artifactId>
<version>1.3.0</version>
<configuration>
<plist>
<CFBundleDisplayName>Games For The Blind</CFBundleDisplayName>
<JVMMainClassName>gamesforblind.Main</JVMMainClassName>
<JVMVersion>12</JVMVersion>
<CFBundleDisplayName>Games For The Blind</CFBundleDisplayName>
<CFBundleName>Games For The Blind</CFBundleName>
</plist>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
UPDATE:
I divided the project into two separate modules: "audio-builder" & "application" - as suggested by Welsh.
However, I have a Java enumeration ("Phrases.java") that both the audio-builder & application uses. The audio-builder needs this file to know which audio phrases are currently in the program, while the rest of the application needs this to load in said audio files & call the playback of these files.
So, this made me add the "audio-builder" module as a dependency for the "application" module. Since the Google Cloud dependency is needed at compile-time, this means that it is bundled in the generated JAR, app, and exe files.
These changes can be found here: https://github.com/hadi16/GamesForTheBlind/tree/Maven-Fixes
Root POM file:
<?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>edu.up</groupId>
<artifactId>games-for-the-blind</artifactId>
<version>1.0.0.0</version>
<modules>
<module>games-for-the-blind/audio-builder</module>
<module>games-for-the-blind/application</module>
</modules>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Audio-builder POM file:
<?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>edu.up</groupId>
<artifactId>audio-builder</artifactId>
<version>1.0.0.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-texttospeech</artifactId>
<version>0.117.0-beta</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>12</source>
<target>12</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>builder.AudioFileBuilder</argument>
</arguments>
<environmentVariables>
<GOOGLE_APPLICATION_CREDENTIALS>google_api_key.json</GOOGLE_APPLICATION_CREDENTIALS>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>
Application POM file (note the dependency to audio-builder):
<?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>edu.up</groupId>
<artifactId>application</artifactId>
<version>1.0.0.0</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Compile Dependencies -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
<scope>compile</scope>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>edu.up</groupId>
<artifactId>audio-builder</artifactId>
<version>1.0.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>12</source>
<target>12</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<outputDirectory>${project.build.directory}/dist</outputDirectory>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>gamesforblind.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-classes</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target/xsd-out</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- Create executable Windows file. -->
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.7.25</version>
<executions>
<execution>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<jar>
${project.build.directory}/dist/${project.artifactId}-${project.version}-jar-with-dependencies.jar
</jar>
<outfile>${project.build.directory}/dist/${project.artifactId}-${project.version}.exe
</outfile>
<classPath>
<mainClass>gamesforblind.Main</mainClass>
</classPath>
<jre>
<minVersion>12</minVersion>
<jdkPreference>preferJre</jdkPreference>
</jre>
<versionInfo>
<copyright>2019</copyright>
<fileVersion>${project.version}</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>${project.name}</fileDescription>
<productVersion>${project.version}</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>${project.name}</productName>
<internalName>${project.name}</internalName>
<originalFilename>${project.artifactId}-${project.version}.exe</originalFilename>
<companyName>University of Portland</companyName>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>de.perdian.maven.plugins</groupId>
<artifactId>macosappbundler-maven-plugin</artifactId>
<version>1.3.0</version>
<configuration>
<plist>
<CFBundleDisplayName>Games For The Blind</CFBundleDisplayName>
<JVMMainClassName>gamesforblind.Main</JVMMainClassName>
<JVMVersion>12</JVMVersion>
<CFBundleDisplayName>Games For The Blind</CFBundleDisplayName>
<CFBundleName>Games For The Blind</CFBundleName>
</plist>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Thank you!
I would recommend that you split your projects into two sub projects, so you would have for example:
games-for-the-blind/
pom.xml
audio-builder/
pom.xml
application/
pom.xml
Then what you can do is have the audio-builder package output the required files into the application/resources directory and have it listed first in the main pom.xml file.
This would allow you to distribute the application resultant files that would not contain any of the details of the audio-builder project.
When I build the maven Module that is using Antlr4 and look in the Jar the compiled generated sources from Antlr4 are in the Root folder.
But when I want to include the Jar with the generated sources in my Antlr4-impl module as dependency where I want to use the generated classes they can't be found.
How I can link them up correctly ? Do I have to move the generated Sources to the maven src/main/java section ? Do they need a package ? If yes, how can I set the package for the sources in the maven plugin ?
Here is My pom.xml form the antlr generation module:
<?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">
<parent>
<artifactId>net-site-arti</artifactId>
<groupId>net.site.reverse</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>net-site-arti-antlr</artifactId>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.7.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.7.1</version>
<configuration>
<outputDirectory>src/main/generated-sources</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
And here is the pom.xml form the module where I want to implement the classes:
<?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">
<parent>
<artifactId>net-site-arti</artifactId>
<groupId>net.site.reverse</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>net-site-arti-antlr-impl</artifactId>
<dependencies>
<dependency>
<groupId>net.site.reverse</groupId>
<artifactId>net-site-arti-antlr</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.7.1</version>
</dependency>
</dependencies>
</project>
EDIT: Add build-helper-maven-plugin same result - the classes are in the root folder from the generated jar but the module that will use them don't pick up the classes.
Tried also with the maven-shade-plugin in this configuration
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern></pattern>
<shadedPattern>org.shaded.plexus.util.</shadedPattern>
<excludes>
<exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
<exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
</excludes>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
different jar but some result - in the jar the classes are under: org/shaded/plexus/util/ but the module can't import the classes.
Not a perfect solution but a solution:
In this post they say you can add the package name in a #header tag in the *.g-File. Unfortunately ANTLR doesn't generate the package in the Sourcefolder it only generated the Class-Files with the package declaration. So you have to generate them in the package:
here is an example pom:
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.7.1</version>
<configuration>
<outputDirectory>src/main/java/net/site/antlr</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
And if you add this to the g-File:
#header {
package net.site.antlr;
}
But you can't generate, with this solution, different grammar in different packages.
I'm using the latest gwt maven plugin (https://tbroyer.github.io/gwt-maven-plugin/index.html) to compile a multi module GWT project and deploy it to tomcat 9. I am also using intellij 14 as my IDE. It's a client app only ie. no server/servlet. When I build via the IDE gwt plugin and zip up and deploy that output to tomcat my app works fine.
However, using the maven plugin, everything compiles ok and the contents of the war look fine to me. The war deploys ok to tomcat, but I simply see a blank page when I try to load it on my browser (latest chrome edition).
I'm running dev tools and jscript console and there are no errors being reported, network view, shows the content downloading ok. I've set break points in my nocache js files and stepped through it with no problems. Below is my pom. I'd appreciated any insight / help with this as it's been bugging me for days..
<?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">
<parent>
<artifactId>guml-ui</artifactId>
<groupId>guml-ui</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>dashboard</artifactId>
<!--<packaging>gwt-app</packaging>-->
<dependencies>
<dependency>
<groupId>guml-ui</groupId>
<artifactId>myworkspace</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>guml-ui</groupId>
<artifactId>project</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>guml-ui</groupId>
<artifactId>common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java/au/com/guml/ui/components/dashboard/public</directory>
</resource>
<resource>
<directory>war</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.0-rc-9</version>
<extensions>true</extensions>
<configuration>
<moduleName>au.com.guml.ui.components.dashboard.Dashboard</moduleName>
<moduleShortName>Dashboard</moduleShortName>
<warDir>${basedir}/../gumlui-war/target/gumlui-war-${project.version}</warDir>
<devmodeWorkDir>${basedir}/../gumlui-war/target/gumlui-war-${project.version}</devmodeWorkDir>
<webappDirectory>${basedir}/../gumlui-war/target/gumlui-war-${project.version}</webappDirectory>
<skipModule>true</skipModule>
<draftCompile>true</draftCompile>
<startupUrls>Dashboard.html</startupUrls>
</configuration>
<executions>
<execution>
<id>compile-module-common</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.common.Common</moduleName>
<moduleShortName>Common</moduleShortName>
</configuration>
</execution>
<execution>
<id>compile-module-myworkspace</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.myworkspace.MyWorkspace</moduleName>
<moduleShortName>MyWorkspace</moduleShortName>
</configuration>
</execution>
<execution>
<id>compile-module-project</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.project.Project</moduleName>
<moduleShortName>Project</moduleShortName>
</configuration>
</execution>
<execution>
<id>compile-module-dashboard</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.dashboard.Dashboard</moduleName>
<moduleShortName>Dashboard</moduleShortName>
</configuration>
</execution>
</executions>
</plugin>
<!-- copy the host html page -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-hosthtml</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/../gumlui-war/target/gumlui-war-${project.version}</outputDirectory>
<resources>
<resource>
<directory>war</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-public</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/../gumlui-war/target/gumlui-war-${project.version}/Dashboard</outputDirectory>
<resources>
<resource>
<directory>src/main/java/au/com/guml/ui/components/dashboard/public</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Cheers,
Matt.
For anyone that is interested I got the maven build working on the multi module gwt project. See the following pom (dashboard) which is my app which inherits other modules.
<?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">
<parent>
<artifactId>guml-ui</artifactId>
<groupId>guml-ui</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>dashboard</artifactId>
<!--<packaging>gwt-app</packaging>-->
<dependencies>
<dependency>
<groupId>guml-ui</groupId>
<artifactId>myworkspace</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>guml-ui</groupId>
<artifactId>project</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>guml-ui</groupId>
<artifactId>common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-sources</artifactId>
<version>4.1.0.Final</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/hibernate-validator-4.1.0.Final-sources.jar</systemPath>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java/au/com/guml/ui/components/dashboard/public</directory>
</resource>
<resource>
<directory>src/main/java</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.0-rc-9</version>
<extensions>true</extensions>
<configuration>
<moduleName>au.com.guml.ui.components.dashboard.Dashboard</moduleName>
<moduleShortName>Dashboard</moduleShortName>
<warDir>${basedir}/../gumlui-war/target/gumlui</warDir>
<devmodeWorkDir>${basedir}/../gumlui-war/target/gumlui</devmodeWorkDir>
<webappDirectory>${basedir}/../gumlui-war/target/gumlui</webappDirectory>
<skipModule>true</skipModule>
<startupUrls>Dashboard.html</startupUrls>
<!--<style>PRETTY</style>-->
</configuration>
<executions>
<execution>
<id>compile-module-common</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.common.Common</moduleName>
<moduleShortName>Common</moduleShortName>
</configuration>
</execution>
<execution>
<id>compile-module-myworkspace</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.myworkspace.MyWorkspace</moduleName>
<moduleShortName>MyWorkspace</moduleShortName>
</configuration>
</execution>
<execution>
<id>compile-module-project</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.project.Project</moduleName>
<moduleShortName>Project</moduleShortName>
</configuration>
</execution>
<execution>
<id>compile-module-dashboard</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.dashboard.Dashboard</moduleName>
<moduleShortName>Dashboard</moduleShortName>
</configuration>
</execution>
</executions>
</plugin>
<!-- copy the host html page -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-public</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/../gumlui-war/target/gumlui/Dashboard</outputDirectory>
<resources>
<resource>
<directory>src/main/java/au/com/guml/ui/components/dashboard/public</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I have to include the build resources entries on this pom and my inherited projects to manually include the public directory, not sure why, this appears to a quirk with the plugin.