pull apache beam from github compile error - maven

I am new to Apache beam, I download latest source code from github and compile runner module under path :
../beam/runners
with command : mvn package and it prints the exception like this :
enter image description here
Apache Beam :: Runners :: Core Construction Java ... FAILURE
Does anyone have some ideas with this ? thanks!

#Balajee Venkatesh
Here are my compile steps:
cd beam-master
mvn compile
wait compile finish
The first time I execute mvn compile command and met the exception shown above was under path beam-master/runners. After I changing compiling path to beam-master everything goes well .
And may I ask are you trying to compile the whole project to load it to your IDE ?
If so , I suggest using IDEA with 'File'->'import from existing source' instead of executing 'mvn compile' command .
If you try to use IDEA import beam , you can just remove/comment error messages in ${project_loc:beam-parent/pom.xml} like :
<!-- <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.3</version>
<reportSets>
<reportSet>
<reports>
<report>dependency-updates-report</report>
<report>plugin-updates-report</report>
</reports>
</reportSet>
</reportSets>
</plugin>-->
and, replace this maven plugins version the same as your mvn -version .
<!-- Rename the artifact produced by the Apache parent's
source release. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>**3.3.3**</version>
<executions>
<execution>
<id>source-release-assembly</id>
<configuration>
<finalName>apache-beam-${project.version}</finalName>
</configuration>
</execution>
</executions>
</plugin>
By the way , my maven version is 3.3.3 . You can also check out if the pom.xml's maven version incompatible with your local mvn -version .
Here is my mvn compile path :
enter image description here

After I changing my compiling path to main path every module compiled success.

Related

SonarQube Scanner for Maven and SonarTsPlugin Cannot Run node

I am using SonarQube 5.6.1 for code analysis (code written in Spring Boot and Angular (using TypeScript)). SonarQube Scanner for Maven 3.4.0.905 and SonarTsPlugin 1.1.0 are used for code scanning in Java and TypeScript, respectively.
In my pom.xml, I have the following properties set:
<frontend.directory>frontend</frontend.directory>
<sonar.host.url>http://sonarqube.some-url.local/</sonar.host.url>
<sonar.sources>src/main/java,${frontend.directory}/src/app,pom.xml</sonar.sources>
<sonar.exclusions>${frontend.directory}/node_modules/**</sonar.exclusions>
<sonar.tests>${frontend.directory}/src/app,src/test/java</sonar.tests>
<sonar.test.inclusions>**/*.spec.ts,src/test/java/**/*.java</sonar.test.inclusions>
<sonar.testExecutionReportPaths>${frontend.directory}/reports/ut_report.xml</sonar.testExecutionReportPaths>
<sonar.ts.coverage.lcovReportPath>${frontend.directory}/coverage/lcov.info</sonar.ts.coverage.lcovReportPath>
<sonar.ts.tslint.configPath>${frontend.directory}/tslint.json</sonar.ts.tslint.configPath>
<sonar.ts.tslint.nodePath>${frontend.directory}/node/node</sonar.ts.tslint.nodepath>
<sonar.ts.tslint.path>${frontend.directory}/node_modules/.bin/tslint</sonar.ts.tslint.path>
Please note that I am pointing sonar.ts.tslint.nodePath to the local node installed as following.
I use frontend-maven-plugin 1.6 to install npm and node:
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
<workingDirectory>${frontend.directory}</workingDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v10.1.0</nodeVersion>
<npmVersion>6.0.1</npmVersion>
</configuration>
</execution>
...
</executions>
</plugin>
I run ./mvnw sonar:sonar to start the SonarQube scanner. However, when the SonarTsPlugin runs and goes to run tslint, the nodePath is ignored and the global node is used. This causes problems in my Jenkins box where I get the following error:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (default-cli) on project nsgra-web: java.io.IOException: Cannot run program "node": error=2, No such file or directory -> [Help 1]
This is odd to me since node is installed via frontend-maven-plugin and I am pointing to that node binary in sonar.ts.tslint.nodePath.
Does anyone have any insight?
Thanks Aerus for your response.
I found the same issue inside docker pod using jenkins.
I had maven installed but not node, then maven create a local installation of node at ./node/ folder. When the TS sonar was trying to execute node to know the current version, the commented error arise and all .ts files was ignored.
I solved using your suggestion and adding this to the command line execution
-Dsonar.typescript.node=./node/node

maven - generate sources is not working

please advise if possible on this
I am running mvn package source:jar and get a module.jar and module-sources.jar as expected in the target directory
However, I have 2 issues:
1) I when I do : mvn install source:jar I get a -source.jar in my "target" in
the local projects folder, HOWEVER, NOT in the "local-repository (under .m2
on my PC). Even though, I do get a module.jar with binaries installed.
EDIT: I have figured this item (1): It works if I place "source:jar" before "install". That is mvn source:jar install instead of mvn install source:jar
2) I want to NOT HAVE TO run source:jar in the command line to generate the sources. Because, when I use GO continuous integration tool, that I have no control over, they do not have a maven goal mvn source:jar there.
I know that with the configurations in the pom.xml it can be achieved, and I did see it occuring once or twice, but it stopped working (well, obviously I made a change,that I do not know that broke this)
My pom.xml has the following
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<outputDirectory>${source.directory}</outputDirectory>
<finalName>${project.jar.name}</finalName>
<fileNameMapping>no-version</fileNameMapping>
<classifier>${source.classifier}</classifier>
</configuration>
</execution>
</executions>
</plugin>
So, ultimately, when I run either mvn package or mvn install or I want to have sources generated as a jar file next to the regular project.jar (or in the specified folder, but it is not essential)

Best way to auto compile compass-style SASS via maven

referring to SASS implementation for Java? :
What is the best way to auto-compile compass-style.org stylesheets in maven goal compile respectively package?
I would not like to ship too many self-compiled libraries nor do I want to dynamically ship compiled files via filters like https://code.google.com/p/sass-java ( https://github.com/darrinholst/sass-java )
Any alternatives than hooking up shellscripts / ant scripts which requires installed ruby and compass on the client?
What is the detailed difference between SASS and Compass Stylesheets, any problems with "sass-tools" when regularly using "compass"? => Which mvn plugins are "compass aware"?!
I suppose you know about this Maven plugin (mentioned in SASS implementation for Java?)? : https://github.com/Jasig/sass-maven-plugin
(I haven't tried it myself yet.)
UPDATE: that plugin is no longer supported. However, this fork seems to be healthy at present, so it might be an option for some: https://github.com/GeoDienstenCentrum/sass-maven-plugin
I found this, it's not a special compass/sass plugin but it works
https://gist.github.com/1671207
I was using the Sass Maven Plugin by nl.geodienstencentrum.maven but it uses Ruby and is very slow.
I've now switched to:
Libsass Maven Plugin
https://github.com/warmuuh/libsass-maven-plugin
This uses C and our compile times are much less (8.6 seconds to -> 2 seconds)
I tried several ways to compile my app (java, Wicket, using Zurb Foundation Sites, node-sass with depebndency of lib-sass). To tell you the truth, all the maven plugins were somewhere a deadend, especially when my scss contained the !global flag. (This flag came with foundations.)
So the final solution for us was to build with npm first then use maven.
Npm builds into src/main/webapp/"myDir" dir. I excluded this dir in git.
The jason file has a line like:
"scripts": {
....
"build-css": "node node_modules/node-sass/bin/node-sass --include-path myScssDir myScssDir/myScss.scss --output src/main/webapp/myDir/css",
....
}
Then build with maven and it will move the builded css ino my war.
For some help (create the nonexisting "myDir" dir) i used mkdirp.
In my jason there is:
"scripts": {
"create-dirs": "mkdirp src/main/webapp/myDir/",
....
}
So i run "npm i" to install all my dependencies locally into node-modules dir. This is gitignored.
Then i run "npm run create-dirs" to create the necessary myDir. This is gitignored as well.
Then i run "npm run build-css" to compile my css-s and js-s into myDir.
Finally i make a maven build.
With a hudson/jenkins build, you can easily do these in one job.
One improvement i can think of is to run npm via ant during maven build. I'll get back to you when i have a proof of concept of this.
//One extra hint: if you are developing under corporate environment and Windows7 you may have to add permissions to symbolic links for npm build. If you find errors in npm build, it worth a try: https://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7
Since libsass-is-deprecated, and the fork bases on the same "archived lib": https://github.com/bit3/jsass ..bases on libsass...
How do I migrate? ... Someone might find this useful:
[choco|brew|npm] install sass
Source: https://sass-lang.com/install
(I would not do it in ci, but we could!)
With the "good ole" exec-maven-plugin, adopted from Spring Petclinic (site|repo) (previously extracting webjars-bootstrap, originally they used that same libsass-maven-plugin):
<profile>
<id>css</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<!-- process-resources > genererate-resources (i.e. later)-->
<phase>process-resources</phase>
</execution>
</executions>
<configuration>
<!-- must be in $PATH !! -->
<executable>sass</executable>
<!-- it is quite silent, when everything works well -->
<useMavenLogger>true</useMavenLogger>
<arguments>
<!-- additional sass path(s), adjust to our suits -->
<argument>--load-path=${project.build.directory}/webjars/META-INF/resources/webjars/bootstrap/${webjars-bootstrap.version}/scss/</argument>
<argument>--no-source-map</argument>
<argument>--verbose</argument>
<argument>--trace</argument>
<!-- for more args, see https://stackoverflow.com/a/70228043/592355 // `sass` -->
<argument>${basedir}/src/main/scss/my.scss</argument>
<argument>/path/to/my/dest/my.css</argument>
</arguments>
<!-- more config, when we like ... -->
</configuration>
</plugin>
<!-- this is not part of the answer, but unpacks us required scss: -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<!-- genererate-resources < process-resources (i.e. prior)-->
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.webjars.npm</groupId>
<artifactId>bootstrap</artifactId>
<version>${webjars-bootstrap.version}</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/webjars</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Finally:
mvn process-resources -Pcss
(assuming no tests, no clean, no compile, "it is quite silent, when everything works well")

Maven : error: generics are not supported in -source 1.3 , I am using 1.6

I have imported an existing Maven project into Eclipse IDE .
I have modified some code in it , it compiled successfully ,
I am using Java 1.6 as compiler
and when i am trying to run maven clean install -X
Its giving the following error
could not parse error message: (use -source 5 or higher to enable generics)
D:\bayer\util\src\main\java\com\tata\bayer\util\BrokerageCalendar.java:179: error: generics are not supported in -source 1.3
private static Hashtable<String, Boolean> nyseHolidays = new Hashtable<String, Boolean>();
^
could not parse error message: (use -source 5 or higher to enable generics)
D:\bayer\util\src\main\java\com\tata\bayer\util\APIHttpXmlClient.java:27: error: generics are not supported in -source 1.3
Class<? extends APIResponse> responseClass) {
^
Please suggest any ideas as how to resolve this ??
Did you declare that you want to use java 1.6 in your project pom.xml?:
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument></compilerArgument>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Configuring the Maven Compiler Plugin will fix the problem. It turns out the problem was caused by the Maven3 package in the Ubuntu repository. An alternate fix is to download Maven 3 from the Apache website which uses a more up to date Compiler plugin.
I wanted to know why this was happening when the documentation states the default Java source is 1.5. To see what mvn is using for your compiler plugin use:
mvn help:effective-pom
My Maven Compiler Plugin was 2.0.2 even though I was using Maven 3.0.4 from the Ubuntu packages.
When I run the same command using Maven 3.0.4 from Apache I have a plugin version 2.3.2, which defaults to Java 1.5 as expected.
You have to configure the Maven Compiler Plugin.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
Another way that doesn't involve modifying the pom is to specify the source and target in the command line:
mvn clean install -Dmaven.compiler.source=1.6 -Dmaven.compiler.target=1.6
Note that this should be avoided generally as the build cannot be guaranteed to be repeatable this way.
I'd prefer this:
<properties>
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
...

Maven Compiler Plugin Fork Option Not Working

I have a maven pom file with the following compiler-plugin:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<executable>${path_to_JDK6}</executable>
<fork>true</fork>
<compilerVerison>1.6</compilerVerison>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
My system's JAVA_HOME is set to a 1.5 JDK. When I run mvn package, maven throws the following error message:
Failure executing javac, but could not parse the error:
javac: invalid target release: 1.6
Usage: javac <options> <source files>
Does anyone have any ideas about why Maven is using the 1.5 JDK instead of forking to the 1.6 executable? Is there any debugging option that I could use? Are the fork and executable options broken in Maven 2?
Note: My system admin would not allow me to change the value of JAVA_HOME and some of my new libraries are written for java 6. So I would like to find a workaround to make maven compile with JDK 1.6.
My ${path_to_JDK6} variable only included the path to the folder containing the JDK. It did not include the /bin/javac. When I added /bin/javac, the 1.6 compiler was invoked.

Resources