Hyperlegder Shim-client-1.0 Jar missing on complilation - maven

Am trying to work with the Hyperlegder Java SDK but am unable to locate the Shim-client jar. See error below.
Information:java: Errors occurred while compiling module 'maven'
Information:javac 1.8.0_74 was used to compile java sources
Information:Module "maven" was fully rebuilt due to project configuration/dependencies changes
Information:16/07/2017, 3:08 PM - Compilation completed with 34 errors and 0 warnings in 14s 362ms
/Java/src/main/java/ZoneSDKInterface.java
Error:(11, 35) java: package org.hyperledger.fabric.shim does not exist
Error:(12, 35) java: package org.hyperledger.fabric.shim does not exist
All the sources i see online require me to download the source from a missing Git repo -≥ https://github.com/hyperledger/fabric/core/chaincode/shim/java
Edit: The source URL is https://github.com/hyperledger/fabric/tree/release/core/chaincode/shim/java
Was able to download the repo and gradle build to get the JAR file.

use bellow dependency
<dependency>
<groupId>me.reactiv.fabric-java-sdk</groupId>
<artifactId>fabric-java-sdk</artifactId>
<version>0.6.6</version>
</dependency>

Related

GMavenPlus: Groovy to JAR - Failed to find or load main class. Main class is present, manifest file appears valid

I've done a successfull mvn clean install on the project I built and the structure appears correct, all classes included and manifest is under META-INF including class-paths and main-class. Not sure what's not matching up here, but the class contents are valid when I checked contents using javap. Main method is present in the redacted_automatedSupport class and is also public.
Error:
host MINGW64 ~/Desktop/Projects/redacted_Automated_Support/target (master)
$ java -jar redacted_automatedSupport-1.0.jar
Error: Could not find or load main class support.redacted_automatedSupport
host MINGW64 ~/Desktop/Projects/redacted_Automated_Support/target (master)
$ java -cp redacted_automatedSupport-1.0.jar support.redacted_automatedSupport
Error: Could not find or load main class support.redacted_automatedSupport
host MINGW64 ~/Desktop/Projects/redacted_Automated_Support/target (master)
$
Manifest contents:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: bennet.vella
Class-Path: aws-java-sdk-s3-1.11.696.jar aws-java-sdk-kms-1.11.696.jar
aws-java-sdk-core-1.11.696.jar commons-logging-1.1.3.jar httpclient-
4.5.9.jar httpcore-4.4.11.jar commons-codec-1.11.jar ion-java-1.0.2.j
ar jackson-databind-2.6.7.3.jar jackson-annotations-2.6.0.jar jackson
-core-2.6.7.jar jackson-dataformat-cbor-2.6.7.jar joda-time-2.8.1.jar
jmespath-java-1.11.696.jar groovy-3.0.1.jar groovy-json-3.0.1.jar gr
oovy-dateutil-3.0.1.jar
Created-By: Apache Maven 3.6.3
Build-Jdk: 1.8.0_231
Main-Class: support.redacted_automatedSupport
Jar Archive Contents (renamed to zip to browse):
Support Jar Contents (removed some unecessary data, all names match):
It is not a complete answer, since it doesn't target the Maven issue I was having, but I did solve the IntelliJ problem I had with the wrong manifest file - and that's because I was creating the manifest in src/main/java when it should have been src/main/resources. This should hopefully alleviate some users' problems.
I have not however resolved how to properly build and include all relevant dependent jars using Maven - intelliJ does this successfully.

Vaadin 10 and springboot - How to package a jar?

The question is simple, but I spent the last 2 days trying to deploy my app. And so far it doesn't.
I have a single CSS file for my style, and when I execute the jar, CSS is not found (404) or the jar won't package.
As stated here: Spring Boot Executable jar structure
"Do not use the src/main/webapp folder if your application will be packaged as a jar"
and
"You should place your static resources in src/main/resources instead."
so put the CSS here:
src/main/resources/styles.css
In Vaadin documentation (which is very pour on how to package...) I import the CSS like this:
#StyleSheet("styles.css")
Source : https://vaadin.com/docs/v11/flow/importing-dependencies/tutorial-include-css.html
Then I package my project:
mvn clean package -Pproduction
I get this error:
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:11.0.0:package-for-production (default) on project importparcoursup: Execution default of goal com.vaadin:vaadin-maven-plugin:11.0.0:package-for-production failed: An import that ends with 'styles.css' cannot be resolved: the corresponding file 'C:\Workspace\lasteclipeandjava10\parcoursup\target\frontend\styles.css' was not found.
[ERROR] Double check the corresponding import and verify the following:
[ERROR] * the import string is correct
[ERROR] * the file imported is either present in 'frontend://' directory of the project or in one of the project WebJar dependencies or in one of the regular jar dependencies
[ERROR] * if the file is present in one of the regular jar dependencies, it should be located in META-INF/resources/frontend directory in the jar
Can someone provide a simple example of a 'springboot + Vaadin10' app packaged as a jar with static resources inside ?
I tried so many configurations (put the CSS in META-INF, include webapp resources in the maven build process...) but after 2 days, I still can't deploy my app on the server!
finally the solution
css has to be here:
src/main/resources/META-INF/resources/frontend/styles.css
then declared as:
#StyleSheet("frontend://styles.css")
This could be helpful too even though I still miss an example:
Vaadin 10 makes some changes to the way it loads static resources,
such as application templates, custom styles and any additional
JavaScript files. The gist of it is that such files should be put in
src/main/webapp/frontend/ when building a .war file and
src/main/resources/META-INF/resources/frontend/ when building a .jar
file.
Link to Vaadin Dokumentation: Vaadin 10 and static resources

Kotlin via a Gradle build script isn't executing a WebDriver spek

Repo with a tight reproduction of my problem: https://github.com/paul-hammant/kotlin-webdriver-snafu
The spec, that could not be simpler:
class WebDriverSpeks : Spek({
ChromeDriverManager.getInstance().setup()
val co = ChromeOptions()
val chromeDriver = ChromeDriver(co) as WebDriver
beforeGroup {
chromeDriver.get("https://yahoo.com/")
}
describe("yahoo") {
it("should have index.html") {
assertEquals(chromeDriver.title, "hello")
}
}
afterGroup {
chromeDriver.close()
}
})
There's no red lines denoting compile failures in Intellij, yet when the gradle build runs it complains about a transitive dep:
$ gradle build
Download https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.24/slf4j- api-1.7.24.jar
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
/Users/paul/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.2.30/f916048adc012c9342b796a5f84c0ac6205abcac/kotlin-stdlib-jdk8-1.2.30.jar (version 1.2)
/Users/paul/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.30/ca12c47fc1e3a7316067b2a51e2f214745ebf8c5/kotlin-stdlib-jdk7-1.2.30.jar (version 1.2)
/Users/paul/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.0.6/3d499d3b7768f88c4796e5a1e357933e11a8936d/kotlin-reflect-1.0.6.jar (version 1.0)
/Users/paul/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.30/2dfac33f8b4e92c9dd1422cd286834701a6f6d6/kotlin-stdlib-1.2.30.jar (version 1.2)
w: Consider providing an explicit dependency on kotlin-reflect 1.2 to prevent strange errors
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath or use '-Xskip-runtime-version-check' to suppress this warning
e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class org.openqa.selenium.chrome.ChromeDriver, unresolved supertypes: org.openqa.selenium.remote.RemoteWebDriver
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 6s
5 actionable tasks: 5 executed
The allegedly unresolved supertype org.openqa.selenium.remote.RemoteWebDriver is in a selenium-remote-driver, and
If I delete ~/.gradle or ./build and try again it is the same.
If I inspect the pom.xml for selenium-java, I can see a dependency on selenium-remote-driver (which exists). See here - http://central.maven.org/maven2/org/seleniumhq/selenium/selenium-java/3.11.0/selenium-java-3.11.0.pom. The one in jcenter is the same.
I don't know why Gradle isn't finding selenium-remote-driver. I have an extra testCompile commented out in the Gradle script but nothing gets fixed if it is commented in.
I think this is a problem in Gradle, or some Gradleized treatment of Maven Central that I don't know much about but is online somewhere. I don't think it is a Kotlin problem. I've used Selenium since it started and am super familiar with it (I've made 100 Maven projects that use Selenium) so I don't think that is it. Of course, I could be wrong with where the root cause is.
Well, this did the trick:
rm -rf ~/.m2/repository/org/seleniumhq/
I didn't know Gradle used the local Maven repo cache. It must have been corrupt somehow.
Hopefully this helps someone another day.

Package org.springframework.aop.framework does not exist

I have installed grails and am trying to compile with the default version of cache:1.1.6 and I'm getting these errors within the plugin code.
Can any one help me with which dependency is broken in the repository - I havent even used the cache yet - just defined it in BuildConfig.groovy
I understand "By default, Grails will not only get the JARs and plugins that you declare, but it will also get their transitive dependencies" so why would I have to declare the dependencies?
Compilation error: startup failed:
Compile error during compilation with javac.
D:\Users\ve\.grails\2.4.0\projects\demo\plugins\cache-1.1.6\src\java\grails\plugin\cache\CustomCacheKeyGenerator.java:18: error: package org.springframework.aop.framework does not exist
import org.springframework.aop.framework.AopProxyUtils;
^
D:\Users\ve\.grails\2.4.0\projects\demo\plugins\cache-1.1.6\src\java\grails\plugin\cache\web\PageInfo.java:43: error: package org.springframework.aop does not exist
import org.springframework.aop.PointcutAdvisor;
^
D:\Users\ve\.grails\2.4.0\projects\demo\plugins\cache-1.1.6\src\java\grails\plugin\cache\web\PageInfo.java:44: error: package org.springframework.aop does not exist
import org.springframework.aop.TargetSource;
Odd this is with a new Grails application? It sounds like it could be a corrupt Maven cache issue. Try doing:
$ rm -rf ~/.m2/repository
Otherwise, to declare the dependency explicitly edit BuildConfig and add:
compile 'org.springframework:spring-aop:4.0.5.RELEASE'
To your dependencies block.

how to include user defined package when do maven compile

Followed is my project structure.
com.company.univ.scheduler.api
--src
----com
-----company
-------univ
--------scheduler
----------api
------------annotation
---Column.java
---Id.java
---pom.xml
-------------model
----App.java
----job.java
----Task.java
----pom.xml
-------------service
----LockService.java
----ResultService.java
----TaskService.java
----pom.xml
Under model folder,the App.java will have to import annotation's java file.
Like
import com.company.univ.scheduler.api.Column;
import com.company.univ.scheduler.api.Id;
Likewise,all files distributed under various folder would be related.How would maven pom.xml handle this issue?
P.S When do maven compile,there always show error message like"can not find symbol;"
"method can not be override"..... I have checked those java files to the target line but no that obvious errors likely to happen,As our project was build in Ant before and all fine.
The maven compile info:
[ERROR] COMPILATION ERROR :
[INFO]-------------------------------------------------------
[ERROR] ..\com.company.univ.scheduler.api\src\com\company\univ\scheduler\api\model\Task.java:[7,50] package com.company.univ.scheduler.api doesnt exist
[ERROR] ..\com.company.univ.scheduler.api\src\com\company\univ\scheduler\api\model\Task.java:[8,50] package com.company.univ.scheduler.api doesnt exist [ERROR] ..\com.company.univ.scheduler.api\src\com\company\univ\scheduler\api\model\Task.java:[26,2] can not find symbol
symbol:class Column
location:class com.company.univ.scheduler.api.model.task
[ERROR] ..\com.company.univ.scheduler.api\src\com\company\univ\scheduler\api\model\Task.java:[22,2] can not find symbol
symbol:class Id
location:class com.company.univ.scheduler.api.model.task
Java source should be in src/main/java, which is the root of your package hierarchy.
I would strongly urge you to use the standard Maven directory layout.
Why are there pom files in each of your packages?

Resources