I'm trying to add a reference to the package PCLCrypto (2.0.147) in a project using NetStandard 1.3
After I add the import "portable-net45+netcore45+wpa81" in the project.json, it builds, but keep showing the errors.
project.json:
{
"supports": {},
"dependencies": {
"Microsoft.EntityFrameworkCore": "1.1.1",
"NETStandard.Library": "1.6.1",
"PCLCrypto": "2.0.147",
"System.ComponentModel.Primitives": "4.1.0",
"WraUtil.Helpers": "1.8.2"
},
"frameworks": {
"netstandard1.3": {
"imports": "portable-net45+netcore45+wpa81"
}
}
}
errors:
Severity Code Description Project File Line Suppression State
Error Package PInvoke.NCrypt 0.3.2 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package PInvoke.NCrypt 0.3.2 supports:
- net40 (.NETFramework,Version=v4.0)
- portable-net40+win8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile92)
- portable-net45+win8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile111)
Error Package Validation 2.2.8 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package Validation 2.2.8 supports:
- dotnet (.NETPlatform,Version=v5.0)
- portable-dnxcore50+monoandroid10+monotouch10+net45+win+wp8+wpa81+xamarinios10 (.NETPortable,Version=v0.0,Profile=net45+dnxcore50+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10)
- portable-net40+sl5+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile328)
Error Package PCLCrypto 2.0.147 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package PCLCrypto 2.0.147 supports:
- monoandroid23 (MonoAndroid,Version=v2.3)
- monotouch10 (MonoTouch,Version=v1.0)
- net45 (.NETFramework,Version=v4.5)
- portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
- portable-win81+wpa81 (.NETPortable,Version=v0.0,Profile=Profile32)
- wp8 (WindowsPhone,Version=v8.0)
- xamarinios10 (Xamarin.iOS,Version=v1.0)
Error One or more packages are incompatible with .NETStandard,Version=v1.3.
Error Package PCLCrypto 2.0.147 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package PCLCrypto 2.0.147 supports:
- monoandroid23 (MonoAndroid,Version=v2.3)
- monotouch10 (MonoTouch,Version=v1.0)
- net45 (.NETFramework,Version=v4.5)
- portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
- portable-win81+wpa81 (.NETPortable,Version=v0.0,Profile=Profile32)
- wp8 (WindowsPhone,Version=v8.0)
- xamarinios10 (Xamarin.iOS,Version=v1.0)
Error One or more packages are incompatible with .NETStandard,Version=v1.3.
Error Package Validation 2.2.8 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package Validation 2.2.8 supports:
- dotnet (.NETPlatform,Version=v5.0)
- portable-dnxcore50+monoandroid10+monotouch10+net45+win+wp8+wpa81+xamarinios10 (.NETPortable,Version=v0.0,Profile=net45+dnxcore50+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10)
- portable-net40+sl5+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile328)
Error Package PInvoke.NCrypt 0.3.2 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package PInvoke.NCrypt 0.3.2 supports:
- net40 (.NETFramework,Version=v4.0)
- portable-net40+win8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile92)
- portable-net45+win8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile111)
Do I need to configure anything else?
In the imports field in your project.json file, you should put a target framework which is compatible with PCLCrypto 2.0.147, and those errors are basically telling you which options you have.
For example, one of those supported target frameworks is portable-net45+win8+wp8+wpa81 which is compatible with netstandard1.0, which means that it can be also referenced by a netstandard1.3 project (you can find here more info about compatibility between the old PCL profiles and new .NET Standard versions).
So, update your imports field to: "imports": "portable-net45+win8+wp8+wpa81".
Small bonus - in case you decide to move from project.json to new MSBuild (csproj) style projects, you can achieve the same with:
<PropertyGroup>
<TargetFramework>netstandard1.3</TargetFramework>
<PackageTargetFallback>portable-net45+win8+wp8+wpa81</PackageTargetFallback>
</PropertyGroup>
Related
I have a Kotlin project in IntelliJ IDEA (not targeting Android) that currently compiles fine with Kotlin 1.6.10. When I change to 1.7.10, I get the following errors:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'jwotd'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0.
Required by:
project :
> The consumer was configured to find a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0:
- gradle70JavadocElements
- gradle70RuntimeElements
- gradle70SourcesElements
- javadocElements
- runtimeElements
- sourcesElements
All of them match the consumer attributes:
- Variant 'gradle70JavadocElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides javadocs but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'gradle70RuntimeElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides a library but the consumer didn't ask for it
- Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
- Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but the consumer didn't ask for it
- Variant 'gradle70SourcesElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides sources but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'javadocElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides javadocs but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides release status but the consumer didn't ask for it
- Variant 'runtimeElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides a library but the consumer didn't ask for it
- Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but the consumer didn't ask for it
- Variant 'sourcesElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides sources but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides release status but the consumer didn't ask for it
The following variants were also considered but didn't match the requested attributes:
- Variant 'apiElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
- Variant 'gradle70ApiElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
My top-level build.gradle:
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
One of my project build.gradle (there are several projects, all similar):
apply plugin: 'org.jetbrains.kotlin.jvm'
sourceSets {
main {
java.srcDirs "src/java"
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
api project(':cjk')
implementation project(':kokuban')
implementation platform('org.jetbrains.kotlin:kotlin-bom')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.beust:klaxon:5.0.1'
implementation "com.oracle.database.xml:xmlparserv2:21.1.0.0"
}
Open your gradle/wrapper/gradle-wrapper.properties file and modify the gradle version to:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
I had to manually upgrade gradle.
./gradlew wrapper --gradle-version 7.5.1
./gradlew --version
./gradlew build
After this, gradlew builds Kotlin 1.7.10 code, and it also builds successfully in IntelliJ IDEA. Interestingly though, the IntelliJ complains about unavailable features (definitely typed T & Any), but it can compile it and it seems to work.
Feels like IntelliJ IDEA CE does not officially support Kotlin 1.7.10 yet?
In my case, Just replace to
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21'
From
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10'
https://kotlinlang.org/docs/gradle.html
When configuring your project, check the Kotlin Gradle plugin compatibility with available Gradle versions:
Kotlin 1.7.20 requires Gradle 6.7.1 as a minimum version. Kotlin 1.7.10 will do similarly.
Please check your Gradle version.
Invalidate Caches and Restart resolved my issue
This is how a freshly generated (by IDEA CE / gradle-7.4.2) build.gradle looks like
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.7.10'
}
group = 'org.example'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.jetbrains.kotlin:kotlin-test'
}
test {
useJUnitPlatform()
}
compileKotlin {
kotlinOptions.jvmTarget = '1.8'
}
compileTestKotlin {
kotlinOptions.jvmTarget = '1.8'
}
You can try adding this in your build and gradle.
kotlinOptions {
jvmTarget = "1.8"
}
IntelliJ version is 2020.1.2
Gauge pluggin version in intelliJ is 0.3.21
Gauge version: 1.0.7
Commit Hash: ed7b4fd6
Plugins
html-report (4.0.11)
java (0.7.2)
screenshot (0.0.1)
Getting the following error:
java.lang.Throwable: Unable to parse <C:\Program Files\Gauge\bin\gauge.exe --version --machine-readable> command's output.
error: open C:\Program Files\Gauge\bin\plugins: The system cannot find the file specified.
{
"version": "1.0.7",
"commitHash": "ed7b4fd6",
"plugins": []
}
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:146)
at com.thoughtworks.gauge.core.GaugeVersion.getVersion(GaugeVersion.java:44)
at com.thoughtworks.gauge.core.GaugeVersion.<clinit>(GaugeVersion.java:26)
at com.thoughtworks.gauge.GaugeComponent.projectOpened(GaugeComponent.java:30)...
Changed Intellij version to 19.3 release and downloaded external gauge plugin version 0.3.18 which is supported by the IDE to fix the issue.
I'm writing a Kotlin program, and using Gradle as the build system, as is customary in that language. I usually work on Windows, but it's time to start testing on Linux, so using WSL for that. Installed Gradle, cloned a copy of my code in WSL...
(base) a#DESKTOP-4B7M920:~/ayane$ gradle -version
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/usr/share/java/groovy-all.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
------------------------------------------------------------
Gradle 4.4.1
------------------------------------------------------------
Build time: 2012-12-21 00:00:00 UTC
Revision: none
Groovy: 2.4.16
Ant: Apache Ant(TM) version 1.10.5 compiled on March 28 2019
JVM: 11.0.7 (Ubuntu 11.0.7+10-post-Ubuntu-2ubuntu218.04)
So far so good, that warning happens sometimes, doesn't seem to portend immediate trouble.
This is my build file, that works on Windows:
(base) a#DESKTOP-4B7M920:~/ayane$ cat build.gradle.kts
plugins {
kotlin("jvm") version "1.3.72"
}
repositories {
jcenter()
}
dependencies {
implementation(kotlin("stdlib"))
testImplementation("org.junit.jupiter:junit-jupiter:5.6.2")
}
tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
Here goes.
(base) a#DESKTOP-4B7M920:~/ayane$ gradle build
> Task :buildEnvironment
------------------------------------------------------------
Root project
------------------------------------------------------------
classpath
No dependencies
BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
<-------------> 0% WAITING
Uh? I could understand if it threw an error because some prerequisite or other was unavailable. But no error, just nothing? What's going on?
You are using the newest version at this time of the Kotlin plugin for Gradle (1.3.72). However, you are using a really old version of Gradle (4.4.1). As you can read from the Kotlin documentation:
The Kotlin Gradle plugin 1.3.72 works with Gradle 4.9 and later.
It is unfortunate that the plugin doesn't check for this and give a more proper error message instead of just silently doing nothing. I guess you could create an issue for Jetbrains on this if you like.
Just as has been mentioned in the comment to your question, I also highly recommend using the wrapper. It ensures that the project is built with a particular declared version of Gradle that you, the build author, has decided on. Otherwise, you will have to document how to set up the environment correctly, including what version of Gradle to install.
Same thing goes for Java: be sure to clearly document which version is required or supported.
As for building in WSL, the only issue I've ever had with it was a remote build cache not working. This was because I had configured Git to checkout with POSIX line endings (LF) for source files, whereas the cache were populated on a Windows machine using CRLF line endings). It doesn't sound like you are using that feature, but other than that, everything has been working fine for me in WSL.
I am using android studio 2.2 and getting the below error while trying to build the project
Error:Cause: com.android.build.gradle.AppPlugin cannot be cast to groovy.lang.GroovyObject
I added classpath 'com.android.tools.build:gradle:2.2.0'
in my top level gradle
My project has 11 modules and compilesdk version is 23,buildtools version is 24.0.2
How can I build the fix the issues and build the project
I met the same problem。
“Your project may be using a third-party plugin which is not compatible with the other plugins... ”as the console reminders。
So you should check your buildscript{dependencies{}} in build.gradle file。
Like this:
dependencies {
......
classpath 'com.android.tools.build:gradle:2.2'
classpath 'com.xxx.gradle.sign:sign:0.2.0'
......
}
and I update the sign plugin from sign:0.2.0 to sign:0.1.0,then it's ok。So you should find the incompatible plugin and update it。
I am trying to create a connector in Mule Studio 3.4 using Devkit 3.3.2.
The following is a maven (3.0.2) command which I used to generate the project structure:
$ mvn archetype:generate -DarchetypeGroupId=org.mule.tools.devkit
-DarchetypeArtifactId=mule-devkit-archetype-cloud-connector
-DarchetypeVersion=3.4.0 -DgroupId=org.hello -DartifactId=hello-connector
-Dversion=1.0-SNAPSHOT -DmuleVersion=3.4.1
-DmuleConnectorName=Hello -Dpackage=org.hello
-DarchetypeRepository=http://repository.mulesoft.org/releases
after this, I did:
"mvn clean package -Ddevkit.studio.package.skip=false -DskipTests"
This gave some errors in Studio that seem related to devkit 3.4.0, therefore decided to change the Mule/Devkit version from 3.4.0 to 3.3.2 in the pom.xml:
<mule.version>3.3.2</mule.version>
<mule.devkit.version>3.3.2</mule.devkit.version>
The following two errors are shown in Studio:
"The project was not built since its build path is incomplete. Cannot
find the class file for org.eclipse.core.runtime.CoreException. Fix
the build path then try building this
project aria-connector Unknown Java Problem"
and
"The type org.eclipse.core.runtime.CoreException cannot be resolved.
It is indirectly referenced from required .class
files AriaActivator.java /aria-connector/target/generated-sources/mule/org/mule/tooling/ui/contribution line
1 Java Problem"
My environment is Mac OS X 10.8.4 (error appears in Windows 7 too), Mule Studio 3.4.0, java version "1.6.0_51".
Has anybody encountered a similar issue or have an idea how to resolve this please?
Thanks
Add:
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>common</artifactId>
<version>3.3.0-v20070426</version>
<scope>provided</scope>
</dependency>
to your POM.