How to organize build with foundation for apps and Maven? - angularjs

I have a project that has :
Java server that is a WAR deployed on Tomcat. It includes all the Java code of my entities, DAO, Service and API.
JS client built with Foundation for Apps. It includes Angular JS, Bower, Gulp and Sass.
I'm trying to organize the build process of this project but I have difficulties to implement it.
As said in this post How to organize full build pipeline with Gulp, Maven and Jenkins, I tried to use the frontend-maven-plugin but without success.
I have the following error :
`
[ERROR]
[ERROR] events.js:141
[ERROR] throw er; // Unhandled 'error' event
[ERROR] ^
[ERROR] Error: client\assets\scss\_settings.scss
[ERROR] Error: File to import not found or unreadable: helpers/functions
[ERROR] Parent style sheet: C:/Dev/Code/Porteo/fr.porteo.parent/fr.porteo.jersey/porteo_fa/client/assets/scss/_settings.scss
[ERROR] on line 32 of client/assets/scss/_settings.scss
[ERROR] >> #import "helpers/functions";
[ERROR] ^`
It would seem there is a problem with the _settings.css file. He don't recognize the tag #import. But where does the problem come from?
It's surely from maven and the frontent-maven-plugin but how to fix it?
Here my pom.xml with plugin dependencies and executions (only npm start is necessary to run the foundation project) :
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<!-- NB! Set <version> to the latest released version of frontend-maven-plugin, like in README.md -->
<version>0.0.29</version>
<configuration>
<workingDirectory>my_foundation_project</workingDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v5.3.0</nodeVersion>
<npmVersion>3.3.12</npmVersion>
</configuration>
</execution>
<execution>
<id>npm start</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>start</arguments>
</configuration>
</execution>
</executions>
</plugin>
So, Have you any solutions or a better way to implement these two applications?

Issue with similar symptoms - caused by bower permissions mismatch

Related

TestEngine with ID 'junit-jupiter' failed to discover tests after maven repackage

I started to receive TestEngine with ID 'junit-jupiter' failed to discover tests error while running my tests by maven after configuring my plugin:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
Without this I was able to run all the tests without any issue by maven. I needed to add this to solve another issue but then I started to receive this error for my integration tests. When I enable log for maven I noticed that it cannot find domain classes(they are not test classes).
Caused by: java.lang.ClassNotFoundException: com.mypackage.domain.MyDomainObject
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 42 more
What can cause this issue any ideas?

build-helper-maven-plugin report error sources is missing

I try to use build-helper-maven-plugin 1.9 to add integration test folder, Pom shows below:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/integrate/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
the maven version is 3.2.2, when I run mvn build-helper:add-source, it throws errors below:
[ERROR] Failed to execute goal org.codehaus.mojo:build-helper-maven-plugin:1.8:add-source (default-cli) on project test: The parameters 'sources' for
goal org.codehaus.mojo:build-helper-maven-plugin:1.8:add-source are missing or invalid -> [Help 1]
appreciate any help
Fix it in Eclipse with install APT M2E Connector, m2e Connector for build-helper-maven-plugin.
now the folder shows in Eclipse correctly.

WebApp Unable to find type, How to compile source into target dir

Basically I'm having to 2 maven modules and one should start the application by inherit the client source from the other one (because the client includes the EntryPoint).
Therefore I have 2 .gwt.xml files and to pom.xml files.
gwt.gwt.xml
<module>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name='org.fusesource.restygwt.RestyGWT' />
<!--Specify the app entry point class. -->
<entry-point class='com.myapp.admin.client.EntryPoint'/>
<source path='client'/>
<source path='rest'/>
<source path='consts'/>
</module>
web.gwt.xml
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name='com.myapp.admin.gwt' />
POM client (gwt), packaging: jar
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
POM web, packaging: war
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
</plugin>
plus it includes a dependency with the gwt-module <classifier>sources</classifier>. I can compile my application without errors but I cannot run it because
[ERROR] [web] - Unable to find type 'com.myapp.admin.client.EntryPoint'
[ERROR] [web] - Hint: Check that the type name 'com.myapp.admin.client.EntryPoint' is really what you meant
[ERROR] [web] - Hint: Check that your classpath includes all required source roots
Which is reasonable because there is no source in the directory. but why is there no source ?
thanks for any help.
When using M2Eclipse with "resolve dependencies from the workspace", dependencies with a type different from jar (e.g. java-source) or a classifier all resolve to the target/classes of the Eclipse project, so you don't actually get the sources in your classpath.
AFAIK, Google Plugin for Eclipse takes the classpath from M2Eclipse, so you won't have the sources there. You need to edit the launch configuration to add the source directories (src/main/java and possibly others) of the projects you depend on to the classpath.

apt maven plugin fail to generate Q classes

I am fixing a legacy project that uses Querydsl apt. For some reason the apt-maven-plugin started to fail. The only workaround I found was to use the alter ego maven-processor-plugin.
I have reinstalled maven, eclipse and M2E with not much success. The maven-apt-plugin is unable to create the Q classes under /target/generated-sources/metamodel.
edit: adding debug from maven
[DEBUG] Configuring mojo com.mysema.maven:apt-maven-plugin:1.0.8:process from pl
ugin realm ClassRealm[plugin>com.mysema.maven:apt-maven-plugin:1.0.8, parent: su
n.misc.Launcher$AppClassLoader#6d9bf996]
[DEBUG] Configuring mojo 'com.mysema.maven:apt-maven-plugin:1.0.8:process' with
basic configurator -->
[DEBUG] (s) logOnlyOnError = true
[DEBUG] (s) outputDirectory = C:\DEV\myproject\mainstuff\mainstuff-jpa\target\generate
d-sources\metamodel
[DEBUG] (s) pluginArtifacts = [com.mysema.maven:apt-maven-plugin:maven-plugin:
1.0.8:, org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile, org.codehaus.ple
xus:plexus-utils:jar:1.5.8:compile, backport-util-concurrent:backport-util-concu
rrent:jar:3.1:compile, org.codehaus.plexus:plexus-interpolation:jar:1.11:compile
, junit:junit:jar:3.8.1:compile]
[DEBUG] (s) processor = com.mysema.query.apt.jpa.JPAAnnotationProcessor
[DEBUG] (s) project = MavenProject: com.yreham.mainstuff:mainstuff-jpa:1.0
# C:\DEV\myproject\mainstuff\mainstuff-jpa\pom.xml
[DEBUG] (s) sourceEncoding = ISO-8859-1
[DEBUG] -- end configuration --
[DEBUG] Using build context: org.sonatype.plexus.build.incremental.DefaultBuildC
ontext#27bb2f11
[ERROR] C:\DEV\myproject\mainstuff\mainstuff-jpa\src\main\java\com\yreham\mainstuff\j
pa\queries\InstancesQuery.java:40: error: cannot find symbol
import com.yreham.mainstuff.jpa.entity.QCIEntity;
Some details of the config m2e - Maven Integration for Eclipse 1.2.0.20120903-1050 org.eclipse.m2e.feature.feature.group Eclipse.org - m2e
java version "1.7.0_15"
Java(TM) SE Runtime Environment (build 1.7.0_15-b03)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
(The target build is Java 1.6)
Here's the old pom XML
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.0.8</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>${apt.target.dir}</outputDirectory>
processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
<logOnlyOnError>true</logOnlyOnError>
</configuration>
</execution>
</executions>
</plugin>
The new POM with bsc plugin
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.0.5</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<outputDirectory>${apt.target.dir}</outputDirectory>
<processors>
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
</processors>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>1.2.0.Final</version>
</dependency>
</dependencies>
</plugin>
Does your project build in command line?
If it doesn't, it'll most probably fail to build in eclipse too.
Now if CLI actually works, have you tried to install m2e-apt? It'll make annotation processing part of eclipse's incremental build process. See https://github.com/jbosstools/m2e-apt/ for more details.
Turns out it was a JPA configuration problem. I didn't see it was using an Hibernate layer on top Querydsl.
Since we moved to the Eclipse J2EE version and added M2E WTP http://www.eclipse.org/m2e-wtp/, the jpa module was correctly reconfigured.

Maven building for GoogleAppEngine, forced to include JDO libraries?

I'm trying to build my application for GoogleAppEngine using maven. I've added the following to my pom which should "enhance" my classes after building, as suggested on the DataNucleus documentation
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>1.1.4</version>
<configuration>
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
According to the documentation on GoogleAppEngine, you have the choice to use JDO or JPA, I've chosen to use JPA since I have used it in the past. When I try to build my project (before I upload to GAE) using mvn clean package I get the following output
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) javax.jdo:jdo2-api:jar:2.3-ec
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=javax.jdo -DartifactId=jdo2-api -Dversion=2.3-ec -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=javax.jdo -DartifactId=jdo2-api -Dversion=2.3-ec -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.datanucleus:maven-datanucleus-plugin:maven-plugin:1.1.4
2) javax.jdo:jdo2-api:jar:2.3-ec
----------
1 required artifact is missing.
for artifact:
org.datanucleus:maven-datanucleus-plugin:maven-plugin:1.1.4
from the specified remote repositories:
__jpp_repo__ (file:///usr/share/maven2/repository),
DN_M2_Repo (http://www.datanucleus.org/downloads/maven2/),
central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Sat Apr 03 16:02:39 BST 2010
[INFO] Final Memory: 31M/258M
[INFO] ------------------------------------------------------------------------
Any ideas why I should get such an error? I've searched through my entire source code and I'm not referencing JDO anywhere, so unless the app engine libraries require it, I'm not sure why I get this message.
The DataNucleus Maven plugin requires the JDO2 API JAR (even for JPA) as documented here and as reported in the trace:
Path to dependency:
1) org.datanucleus:maven-datanucleus-plugin:maven-plugin:1.1.4
2) javax.jdo:jdo2-api:jar:2.3-ec
The odd part is that jdo2-api-2.3-ec.jar is in the DataNucleus Maven repository (that is declared in the POM of the plugin) and Maven has checked this repository as we can see in the trace.
Update: Ok, this is definitely weird and I don't know why the build is failing exactly (maybe a problem with dependencies ranges). As a workaround, declare the JDO2 API JAR as dependency in the plugin:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>1.1.4</version>
<configuration>
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo2-api</artifactId>
<version>2.3-ec</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
...
</plugins>
...
</build>
</project>
With this dependency declared, the JAR gets downloaded.

Resources