Installing Mahout with Maven on OS X Eclipse - java

I am trying to play with Mahout.
Following very simple instructions on the apache website. I'm getting weird dependency errors.
I've created a new project with Maven. I've added this to the pom.xml as suggested:
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-mrlegacy</artifactId>
<version>0.9</version>
</dependency>
now running 'mvn clean install -U' gives me:
Downloading: https://repo.maven.apache.org/maven2/org/apache/mahout/mahout-mrlegacy/0.9/mahout-mrlegacy-0.9.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.689 s
[INFO] Finished at: 2015-03-21T10:54:37+00:00
[INFO] Final Memory: 6M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project my-app: Could not resolve dependencies for project com.mycompany.app:my-app:jar:1.0-SNAPSHOT: Could not find artifact org.apache.mahout:mahout-mrlegacy:jar:0.9 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
Java is too hard! Seriously, I'm a Ruby guy. Now I also tried 'artifactID' as just 'mahout' as I can see that in some of these alleged maven repositories, but same error.
What am I doing wrong???

The documentation of Apache Mahout appears to have a version mix-up. mahout-mrlegacy does not exist in version 0.9, but it will exist in version 0.10.0. For version 0.9, the dependency is actually mahout-core.
Therefore, you should use
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-core</artifactId>
<version>0.9</version>
</dependency>
When 0.10.0 will be released, you will need to use
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-mrlegacy</artifactId>
<version>0.10.0</version>
</dependency>

Add below dependency to your pom.xml
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-mrlegacy</artifactId>
<version>0.9.0.2.2.0.0-2041</version>
</dependency>
And below repositories
<repositories>
<repository>
<id>pentaho-releases</id>
<url>http://repository.pentaho.org/artifactory/repo/</url>
</repository>
</repositories>
For more details:
https://mvnrepository.com/artifact/org.apache.mahout/mahout-mrlegacy/0.9.0.2.2.0.0-2041

Related

Different version of component (from what is defined in pom) being looked up during maven clean install

I have a dependency and a few dependent projects.
In the pom of dependency project, I have this -
<properties>
<jackson-core.version>2.6.1</jackson-core.version>
<jackson-core-asl.version>1.9.13</jackson-core-asl.version>
<jackson.version>1.9.13</jackson.version>
<jackson-databind.version>2.6.1</jackson-databind.version>
</properties>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson-core.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson-core.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml</groupId>
<artifactId>jackson-module-hibernate</artifactId>
<version>${fasterxml.version} </version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>${jackson-core-asl.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind.version}</version>
</dependency>
</dependencies>
jackson-databind.version is set to 2.6.1. After building the dependency project, when I run clean install on one of these dependent projects, I am getting the following errors, with version lookup failing for jackson-databind jar version 1.9.13 -
[ERROR] Failed to execute goal on project project-app: Could not resolve dependencies for project com.something:project-app:jar:1.0.1-SNAPSHOT: Failed to collect dependencies at org.springframework.boot:spring-boot-starter-web:jar:1.2.5.RELEASE -> com.fasterxml.jackson.core:jackson-databind:jar:1.9.13: Failed to read artifact descriptor for com.fasterxml.jackson.core:jackson-databind:jar:1.9.13: Could not transfer artifact com.fasterxml.jackson.core:jackson-databind:pom:1.9.13 from/to nexus-releases-prepaid (https://project.com/repository/maven-snapshots): Failed to transfer https://project.com/repository/maven-snapshots/com/fasterxml/jackson/core/jackson-databind/1.9.13/jackson-databind-1.9.13.pom. Error code 400, Repository version policy: SNAPSHOT does not allow version: 1.9.13 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project project-app: Could not resolve dependencies for project com.project:project-app:jar:1.0.1-SNAPSHOT: Failed to collect dependencies at org.springframework.boot:spring-boot-starter-web:jar:1.2.5.RELEASE -> com.fasterxml.jackson.core:jackson-databind:jar:1.9.13
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:269)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:147)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:248)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:202)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.project:project-app:jar:1.0.1-SNAPSHOT: Failed to collect dependencies at org.springframework.boot:spring-boot-starter-web:jar:1.2.5.RELEASE -> com.fasterxml.jackson.core:jackson-databind:jar:1.9.13
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:178)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:243)
... 23 more
Caused by: org.eclipse.aether.collection.DependencyCollectionException: Failed to collect dependencies at org.springframework.boot:spring-boot-starter-web:jar:1.2.5.RELEASE -> com.fasterxml.jackson.core:jackson-databind:jar:1.9.13
at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:284)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:279)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:169)
... 24 more
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for com.fasterxml.jackson.core:jackson-databind:jar:1.9.13
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:255)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:171)
at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.resolveCachedArtifactDescriptor(DefaultDependencyCollector.java:530)
at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.getArtifactDescriptorResult(DefaultDependencyCollector.java:515)
at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:403)
at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:356)
at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.process(DefaultDependencyCollector.java:344)
at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.doRecurse(DefaultDependencyCollector.java:498)
at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:451)
at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:356)
at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.process(DefaultDependencyCollector.java:344)
at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:247)
... 26 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact com.fasterxml.jackson.core:jackson-databind:pom:1.9.13 from/to nexus-releases-prepaid (https://project.com/repository/maven-snapshots): Failed to transfer https://project.com/repository/maven-snapshots/com/fasterxml/jackson/core/jackson-databind/1.9.13/jackson-databind-1.9.13.pom. Error code 400, Repository version policy: SNAPSHOT does not allow version: 1.9.13
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:423)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:225)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:202)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:240)
... 37 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact com.fasterxml.jackson.core:jackson-databind:pom:1.9.13 from/to nexus-releases-prepaid (https://project.com/repository/maven-snapshots): Failed to transfer https://project.com/repository/maven-snapshots/com/fasterxml/jackson/core/jackson-databind/1.9.13/jackson-databind-1.9.13.pom. Error code 400, Repository version policy: SNAPSHOT does not allow version: 1.9.13
at io.takari.aether.connector.AetherRepositoryConnector$2.wrap(AetherRepositoryConnector.java:856)
at io.takari.aether.connector.AetherRepositoryConnector$2.wrap(AetherRepositoryConnector.java:1)
at io.takari.aether.connector.AetherRepositoryConnector$GetTask.flush(AetherRepositoryConnector.java:630)
at io.takari.aether.connector.AetherRepositoryConnector.get(AetherRepositoryConnector.java:309)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:499)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:400)
... 40 more
Caused by: io.takari.aether.connector.TransferException: Failed to transfer https://project.com/repository/maven-snapshots/com/fasterxml/jackson/core/jackson-databind/1.9.13/jackson-databind-1.9.13.pom. Error code 400, Repository version policy: SNAPSHOT does not allow version: 1.9.13
at io.takari.aether.connector.AetherRepositoryConnector.handleResponseCode(AetherRepositoryConnector.java:372)
at io.takari.aether.connector.AetherRepositoryConnector.access$8(AetherRepositoryConnector.java:362)
at io.takari.aether.connector.AetherRepositoryConnector$GetTask.resumableGet(AetherRepositoryConnector.java:574)
at io.takari.aether.connector.AetherRepositoryConnector$GetTask.run(AetherRepositoryConnector.java:452)
at io.takari.aether.connector.AetherRepositoryConnector.get(AetherRepositoryConnector.java:303)
... 42 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/DependencyResolutionException
There is no 1.9.13 version defined with - jackson-databind. Version defined for jackson-databind is 2.6.1 and for jackson-mapper-asl is 1.9.13. It seems to be taking the version defined for the latter. I am not sure why it is associating this version.
Note - the repository from which the download is being attempted is defined in the settings.xml
Update
In the dependent project, also, which I am trying to compile, I have version specified as -
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.6.1</version>
</dependency>
Update 2
As per #Serg's comments, I did the following -
I added the exclusion against spring-boot-starter-web in both the dependency and the dependent project.
I reran clean install on both the projects as well. However, I am still seeing the attempt to download 1.9.13 even after adding the exclusions.
Update 3
Extract from output of mvn dependency:tree of dependency project -
[INFO] +- org.springframework.security.oauth:spring-security-oauth2:jar:2.3.6.RELEASE:compile
[INFO] | \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.1:compile
Above is followed by BUILD SUCCESS
Output of dependent project
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building project-app 1.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://project.com/repository/maven-snapshots/com/fasterxml/jackson/core/jackson-databind/1.9.13/jackson-databind-1.9.13.pom
^MDownloading: https://project.com/repository/maven-snapshots/com/fasterxml/jackson/core/jackson-annotations/1.9.13/jackson-annotations-1.9.13.pom
^MDownloading: https://project.com/repository/maven-snapshots/com/fasterxml/jackson/core/jackson-core/1.9.13/jackson-core-1.9.13.pom
^M[WARNING] The POM for com.project:project-security:jar:1.0.1-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.project:project-issuer:jar:1.0.1-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.project:project-lend:jar:1.0.1-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.project:project-bank:jar:1.0.1-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.project:project-subscription:jar:1.0.1-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.project:project-social:jar:1.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.307 s
[INFO] Finished at: 2019-07-26T15:34:00+05:30
[INFO] Final Memory: 20M/316M
If you have jackson-databind then you don't need to import jackson-core as the former already includes the latter.
As you can see jackson-databind:2.6.1 contains jackson-core:2.9.9 while you are manually importing jackson-core:2.6.1 and therefore get version conflict.
More generally, run mnv dependency:tree to see all the dependencies and look for a duplicates, specially the ones with different versions.
EDIT
Also as I can see from the stacktrace you use spring-boot-starter-web of the older versions, which also contains jackson-databind.
If you want to use jackson-databind of newer versions, than Spring provides - make the exclusion
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
</exclusion>
</exclusions>
</dependency>
Otherwise, remove your duplicates and use out-of-the-box Spring solutions.
But as I can see your spring version is quite old, so I'd advise excluding jackson as in the example above.
Available Jackson Databind versions from Maven Central
EDIT 2
To make this all work I believe it would be enough to
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml</groupId>
<artifactId>jackson-module-hibernate</artifactId>
<version>1.9.1</version>
</dependency>
The only thing I'm not sure about is jackson-module-hibernate as I have no practice in using it.

Why java pacakges are not loading in intelliJ ideda

I followed a tutorial and get this dependency file in maven project in intelliJ IDEA 2018.3
My pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>kafka.sample.firstProject</groupId>
<artifactId>kafka-first-sample</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
<kafka.version>2.1.0</kafka.version>
</properties>
<build>
<plug
ins>
<!-- Maven Compiler Plugin-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Apache Kafka Clients-->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.0.0</version>
</dependency>
<!-- Apache Kafka Streams-->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-streams</artifactId>
<version>2.0.0</version>
</dependency>
<!-- Apache Log4J2 binding for SLF4J -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.11.0</version>
</dependency>
<!-- JUnit5 Jupiter -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<!-- JUnit 5 Jupiter Engine -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<!-- JUnit 5 Jupiter Parameterized Testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
but whenever i try to run my build it throws this:
Error:(3, 41) java: package org.apache.kafka.clients.producer does not
exist and so on ...
Even after trying to run maven build still the problem persist.
Believe it or not i have get stuck in this problem from last many days.
Edit:
As #Parsecer asked to show maven build log, i found that there is an error as well
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building kafka-first-sample 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.329 s
[INFO] Finished at: 2019-02-20T09:10:30+05:00
[INFO] Final Memory: 7M/34M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): No such host is known (repo.maven.apache.org) -> [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
Process finished with exit code 1
1) Check settings of IntelliJ by Ctrl-Alt-S. Type 'Maven' and see if you have proper Maven distribution (not the bundled one).
2) Refresh your Maven project from the right hand side of IntelliJ window.
This happens due to several issues which normally fixed after an IDE restart. Well you can try several things,
Do a maven reimport
Do a maven Download sources and documentation
And restart the JIdea IDE
You can try to use a latest maven version and see also.
My System was behind a Proxy which not allowing me to get these packages. I remove the proxy and now it is working fine.

Can't install Selenium locally on CircleCI

I wanted to use Selenium inside an application but I am having some problems with CircleCI.
I have 3 jar files inside lib/ folder: client-combined-3.14.0.jar, htmlunit-driver-2.32.1-jar-with-dependencies.jar and core.jar.
The first 2 jars are for the Selenium library and the third one is the Processing language core jar for control.
This is my .circleci/config.yml:
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4
branches:
only:
- develop
working_directory: ~/repo
environment:
# Customize the JVM maximum heap limit
MAVEN_OPTS: -Xmx3200m
steps:
- checkout
# installing packages
- run: mvn install:install-file -Dfile="lib/client-combined-3.14.0.jar" -DgroupId="com.openqa" -DartifactId="selenium" -Dversion="3.14.0" -Dpackaging=jar -DgeneratePom=true
- run: mvn install:install-file -Dfile="lib/htmlunit-driver-2.32.1-jar-with-dependencies.jar" -DgroupId="com.openqa.selenium" -DartifactId="htmlunit" -Dversion="2.32.1" -Dpackaging=jar -DgeneratePom=true
- run: mvn install:install-file -DgroupId="processing" -DartifactId="core" -Dversion="3.3.7" -Dpackaging=jar -Dfile="lib/core.jar" -DgeneratePom=true
# run tests!
- run: echo "Testing"
- run: mvn test
This is my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.157239n</groupId>
<artifactId>niche-finder</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>7</source>
<target>7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.1.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openqa</groupId>
<artifactId>selenium</artifactId>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>org.openqa.selenium</groupId>
<artifactId>htmlunit</artifactId>
<version>2.32.1</version>
</dependency>
<dependency>
<groupId>processing</groupId>
<artifactId>core</artifactId>
<version>3.3.7</version>
</dependency>
</dependencies>
</project>
On CircleCI, all 3 jars are installed correctly. More specifically, this is the part of the message when mvn install is run (above it is just a bunch of downloads from the maven repository):
[INFO] Installing /home/circleci/repo/lib/client-combined-3.14.0.jar to /home/circleci/.m2/repository/com/openqa/selenium/3.14.0/selenium-3.14.0.jar
[INFO] Installing /tmp/mvninstall8216458170018038185.pom to /home/circleci/.m2/repository/com/openqa/selenium/3.14.0/selenium-3.14.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.993 s
[INFO] Finished at: 2018-08-18T23:00:14Z
[INFO] ------------------------------------------------------------------------
And this is the part of the message when installing the controlled processing jar:
[INFO]
[INFO] --------------------------------------------
[INFO] Building niche-finder 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) # niche-finder ---
[INFO] Installing /home/circleci/repo/lib/core.jar to /home/circleci/.m2/repository/processing/core/3.3.7/core-3.3.7.jar
[INFO] Installing /tmp/mvninstall6601326226754451883.pom to /home/circleci/.m2/repository/processing/core/3.3.7/core-3.3.7.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.472 s
[INFO] Finished at: 2018-08-18T23:00:18Z
[INFO] ------------------------------------------------------------------------
However, when mvn test is run, this error occurs:
[ERROR] Failed to execute goal on project niche-finder: Could not resolve dependencies for project com.157239n:niche-finder:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: org.openqa:selenium:jar:3.14.0, org.openqa.selenium:htmlunit:jar:2.32.1: Could not find artifact org.openqa:selenium:jar:3.14.0 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
It appears that the 2 selenium jars were not installed correctly but the Processing jar installed just fine.
So is this an error on Selenium side? Or what did I do wrong?
Please note that currently I just want to resolve dependencies in Selenium and not actually running a Selenium server on CircleCI.
I tried not to rely on jar files downloaded from https://www.seleniumhq.org/ and use the repository directly from this and this from the maven repository at https://mvnrepository.com/artifact/org.seleniumhq.selenium
Then I don't install the local jar file altogether, just install the controlled core.jar and changed part of my pom.xml to
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-htmlunit-driver</artifactId>
<version>2.52.0</version>
</dependency>
Then everything builds just fine.

GWT Module com.vaadin.v7.Vaadin7WidgetSet not found

I have converted my existing project from vaadin 7 to vaadin 8 successfully. There is no error in the project, but when I use mvn install to build the project. I am getting this error:- GWT Module com.vaadin.v7.Vaadin7WidgetSet not found in project sources or resources.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:51 min
[INFO] Finished at: 2017-12-19T12:31:15+05:30
[INFO] Final Memory: 94M/1007M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:8.0.6:compile (default) on project XXX: GWT Module com.vaadin.v7.Vaadin7WidgetSet not found in project sources or resources. -> [Help 1]
From here:
Check the following:
You have to replace the vaadin-server dependency with vaadin-compatibility-server.
If you are using the default widgetset (you are not compiling it by yourself):
Replace the vaadin-client-compiled dependency with vaadin-compatibility-client-compiled.
Add #Widgetset("com.vaadin.v7.Vaadin7WidgetSet") to your UI implementations.
If you are using a custom widgetset:
Replace the vaadin-client dependency with vaadin-compatibility-client.
Recompile it.
In your POM I see these lines:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>7.5.10</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>7.5.10</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>7.5.10</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<version>7.5.10</version>
<exclusions>
<exclusion>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
This won't work, you can't include any version 7 components, servers, clients.
The only valid thing, is to use the v8-compatibility things.

external maven repo and jenkins

I have an external jar(meaning not available in a public repo), that i want o include in my build.
I used the instructions found on this site:
http://charlie.cu.cc/2012/06/how-add-external-libraries-maven/
and it works, when I do mvn install in my PC.
But when I am building the maven project using Jenkins, i get the following error:
Executing Maven: -B -f D:\Program Files (x86)\Jenkins\workspace\rmy
job\pom.xml install [INFO] Scanning for projects... [INFO]
[INFO]
[INFO] Building xxxxxx 0.0.1-SNAPSHOT [INFO]
[WARNING] The POM for sqljdbc:sqljdbc_4.0:jar:v4 is missing, no
dependency information available
[INFO]
[INFO] BUILD FAILURE [INFO]
------------------------------------------------------------------------ [INFO] Total
time: 1.705s [INFO] Finished at: Tue Feb 11 10:29:23 EET
2014
[INFO] Final Memory: 13M/307M
[ERROR] Failed to execute goal on project xxxxxx: Could not resolve
dependencies for project com.xx:xxxxxxx:jar:0.0.1-SNAPSHOT: Failure to
find sqljdbc:sqljdbc_4.0:jar:v4 in
http://repository.codehaus.org/org/codehaus was cached in the local
repository, resolution will not be reattempted until the update
interval of codehaus has elapsed or updates are forced -> [Help 1]
The pom that i am using has these entries for repositories:
<repositories>
<repository>
<id>codehaus</id>
<url>http://repository.codehaus.org/org/codehaus</url>
</repository>
<!-- In Project repository -->
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/libs</url>
</repository>
Any ideas why this is happening?
After some tries, i did the following workaround in pom.xml
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/libs</url>
</repository>
and
<dependency>
<groupId>sqljdbc</groupId>
<artifactId>sqljdbc_4.0</artifactId>
<version>v4</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/sqljdbc/sqljdbc_4.0/v4/sqljdbc_4.0-v4.jar</systemPath>
</dependency>
This means that the system path is needed as a whole and not just
<url>file://${project.basedir}/lib</url>
as it was mentioned above.
By this "workaround" I got it to work both locally and remotely (Jenkins-Git)
Actually that might be hppen that it can't get the jar from lib.
tyr it with other way.
right click project
select property
java build path
select Lib
add external jar and put set path of your jar files
finish
clean and build your project.
OR
<repositories>
<repository>
<id>local123</id>
<name>localRepo</name>
<url>file://${project.basedir}/lib</url>
</repository>
</repositories>
try putting this code in pom.xml file.
hope your problem can be resolve using this.
As a general rule I always strongly recommend to
use a Maven Repository Manager such as Nexus
only manage repositories in the Maven Repository Manager, not in the POMs
use the Maven Repository Manager to host third-party libraries not available from any other repository
configure your settings file
This is a key to get stable and reproducible builds - even when one of the repositories is temporarily unavailable.

Categories

Resources