Popular New Releases in HTML
foundation-sites
Foundation for Sites v6.7.4
alpine
v3.10.2
uikit
linux-command
v1.8.0
twemoji
Twemoji 13.1.1 update
Popular Libraries in HTML
by ripienaar html
53713
A list of SaaS, PaaS and IaaS offerings that have free tiers of interest to devops and infradev
by google html
31786 Apache-2.0
Material Design Components in HTML/CSS/JS
by google html
30339 Apache-2.0
Style guides for Google-originated open-source projects
by foundation html
29226 MIT
The most advanced responsive front-end framework in the world. Quickly create prototypes and production code for sites that work on any kind of device.
by fengdu78 html
24299
吴恩达老师的机器学习课程个人笔记
by facebookresearch html
22903 MIT
Library for fast text representation and classification.
by harvesthq html
22154 NOASSERTION
Deprecated - Chosen is a library for making long, unwieldy select boxes more friendly.
by PKUanonym html
21812 CC-BY-SA-4.0
清华大学计算机系课程攻略 Guidance for courses in Department of Computer Science and Technology, Tsinghua University
by Polymer html
21662 NOASSERTION
Our original Web Component library.
Trending New libraries in HTML
by docker html
14536 CC0-1.0
Awesome Docker Compose samples
by mattermost html
10753 NOASSERTION
Focalboard is an open source, self-hosted alternative to Trello, Notion, and Asana.
by PanDownloadServer html
8769
PanDownload的个人维护版本
by PKUFlyingPig html
5357 NOASSERTION
计算机自学指南
by alexeygrigorev html
5065 CC-BY-4.0
Data science interview questions and answers
by linkedin html
4921 NOASSERTION
At LinkedIn, we are using this curriculum for onboarding our entry-level talents into the SRE role.
by mdn html
4840 NOASSERTION
The content behind MDN Web Docs
by ChartsCSS html
4388 MIT
Open source CSS framework for data visualization.
by abhivaikar html
4151 CC0-1.0
A collection of public resources about how software companies test their software
Top Authors in HTML
1
75069 Libraries
0
2
11851 Libraries
419
3
1512 Libraries
4
4
1484 Libraries
0
5
1437 Libraries
49
6
1266 Libraries
0
7
924 Libraries
4
8
804 Libraries
7
9
803 Libraries
0
10
724 Libraries
6
1
75069 Libraries
0
2
11851 Libraries
419
3
1512 Libraries
4
4
1484 Libraries
0
5
1437 Libraries
49
6
1266 Libraries
0
7
924 Libraries
4
8
804 Libraries
7
9
803 Libraries
0
10
724 Libraries
6
Trending Kits in HTML
Radiology and image processing are time-consuming and human expertise dependent activities leading to wait times and potential errors. AI is improving the speed and quality of healthcare image processing. Here are some popular libraries that I found useful for healthcare image processing.
The primary technologies for creating Web pages are HTML and CSS. HTML provides the page structure while CSS handles the visual layout.
HTML, which stands for "Hypertext Markup Language.", forms the foundation for defining the arrangement and content of web pages. HTML operates by utilizing a series of tags that mark specific elements within a page. CSS, which stands for Cascading Style Sheets, is a language employed for creating stylesheets that govern the arrangement and design of HTML documents.
This kit has some simple-to-use exercise in HTML/CSS to help someone new to Web Development to learn how to program in HTML/CSS and get started with their journey.
For a detailed tutorial on installing & executing the solution as well as learning resources including training & certification opportunities, please visit the OpenWeaver Community
Knowledge Resources for basics
Kit Solution Source
Support
If you need help using this kit, you may reach us at the OpenWeaver Community.
JavaScript is a scripting language. JavaScript can do anything almost any other language can do, at comparable speeds. This kit has some simple-to-use exercises in JavaScript to help someone new to learn how to program in JavaScript and get started with their journey.
For a detailed tutorial on installing & executing the solution as well as learning resources including training & certification opportunities, please visit the OpenWeaver Community
Knowledge Resources for basics in JavaScript
Support
If you need help using this kit, you may reach us at the OpenWeaver Community.
Trending Discussions on HTML
Springboot 2.6.0 / Spring fox 3 - Failed to start bean 'documentationPluginsBootstrapper'
Your project requires a newer version of the Kotlin Gradle plugin. (Android Studio)
ESlint - Error: Must use import to load ES Module
Allow insecure protocols, android gradle
How did print(*a, a.pop(0)) change?
Log4j vulnerability - Is Log4j 1.2.17 vulnerable (was unable to find any JNDI code in source)?
What's the mathematical reason behind Python choosing to round integer division toward negative infinity?
Build Warning : Mapping new ns to old ns
Where to put formatMsgNoLookups in the Log4j XML configuration file
What is "<[_]>" in Rust?
QUESTION
Springboot 2.6.0 / Spring fox 3 - Failed to start bean 'documentationPluginsBootstrapper'
Asked 2022-Mar-25 at 06:14I'm trying to initiate a Springboot project using Open Jdk 15, Springboot 2.6.0, Springfox 3. We are working on a project that replaced Netty as the webserver and used Jetty instead because we do not need a non-blocking environment.
In the code we depend primarily on Reactor API (Flux, Mono), so we can not remove org.springframework.boot:spring-boot-starter-webflux
dependencies.
I replicated the problem that we have in a new project.: https://github.com/jvacaq/spring-fox.
I figured out that these lines in our build.gradle file are the origin of the problem.
1compile("org.springframework.boot:spring-boot-starter-web") {
2 exclude module: "spring-boot-starter-tomcat"
3}
4compile("org.springframework.boot:spring-boot-starter-jetty")
5
Here is the build.gradle
file:
1compile("org.springframework.boot:spring-boot-starter-web") {
2 exclude module: "spring-boot-starter-tomcat"
3}
4compile("org.springframework.boot:spring-boot-starter-jetty")
5plugins {
6 id 'org.springframework.boot' version '2.6.0'
7 id 'io.spring.dependency-management' version '1.0.11.RELEASE'
8 id 'java'
9}
10
11group = 'com.example'
12version = '0.0.1-SNAPSHOT'
13sourceCompatibility = '11'
14
15repositories {
16 mavenCentral()
17}
18
19dependencies {
20 compile("org.springframework.boot:spring-boot-starter-web") {
21 exclude module: "spring-boot-starter-tomcat"
22 }
23 compile("org.springframework.boot:spring-boot-starter-jetty")
24 implementation 'org.springframework.boot:spring-boot-starter-webflux'
25 testImplementation 'org.springframework.boot:spring-boot-starter-test'
26 testImplementation 'io.projectreactor:reactor-test'
27 implementation "io.springfox:springfox-boot-starter:3.0.0"
28}
29
30test {
31 useJUnitPlatform()
32}
33
34
I issued the command gradle clean bootrun
. The result is this error:
1compile("org.springframework.boot:spring-boot-starter-web") {
2 exclude module: "spring-boot-starter-tomcat"
3}
4compile("org.springframework.boot:spring-boot-starter-jetty")
5plugins {
6 id 'org.springframework.boot' version '2.6.0'
7 id 'io.spring.dependency-management' version '1.0.11.RELEASE'
8 id 'java'
9}
10
11group = 'com.example'
12version = '0.0.1-SNAPSHOT'
13sourceCompatibility = '11'
14
15repositories {
16 mavenCentral()
17}
18
19dependencies {
20 compile("org.springframework.boot:spring-boot-starter-web") {
21 exclude module: "spring-boot-starter-tomcat"
22 }
23 compile("org.springframework.boot:spring-boot-starter-jetty")
24 implementation 'org.springframework.boot:spring-boot-starter-webflux'
25 testImplementation 'org.springframework.boot:spring-boot-starter-test'
26 testImplementation 'io.projectreactor:reactor-test'
27 implementation "io.springfox:springfox-boot-starter:3.0.0"
28}
29
30test {
31 useJUnitPlatform()
32}
33
34 gradle clean bootrun
35
36> Task :bootRun FAILED
37
38 . ____ _ __ _ _
39 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
40( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
41 \\/ ___)| |_)| | | | | || (_| | ) ) ) )
42 ' |____| .__|_| |_|_| |_\__, | / / / /
43 =========|_|==============|___/=/_/_/_/
44 :: Spring Boot :: (v2.6.0)
45
462021-11-19 09:41:06.665 INFO 16666 --- [ main] c.e.springfox.SpringFoxApplication : Starting SpringFoxApplication using Java 15.0.2 on advance-Inspiron-5379 with PID 16666 (/home/advance/projects/spring-fox/build/classes/java/main started by advance in /home/advance/projects/spring-fox)
472021-11-19 09:41:06.666 INFO 16666 --- [ main] c.e.springfox.SpringFoxApplication : No active profile set, falling back to default profiles: default
482021-11-19 09:41:07.294 INFO 16666 --- [ main] org.eclipse.jetty.util.log : Logging initialized @1132ms to org.eclipse.jetty.util.log.Slf4jLog
492021-11-19 09:41:07.396 INFO 16666 --- [ main] o.s.b.w.e.j.JettyServletWebServerFactory : Server initialized with port: 8080
502021-11-19 09:41:07.398 INFO 16666 --- [ main] org.eclipse.jetty.server.Server : jetty-9.4.44.v20210927; built: 2021-09-27T23:02:44.612Z; git: 8da83308eeca865e495e53ef315a249d63ba9332; jvm 15.0.2+7-27
512021-11-19 09:41:07.417 INFO 16666 --- [ main] o.e.j.s.h.ContextHandler.application : Initializing Spring embedded WebApplicationContext
522021-11-19 09:41:07.417 INFO 16666 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 713 ms
532021-11-19 09:41:07.474 INFO 16666 --- [ main] org.eclipse.jetty.server.session : DefaultSessionIdManager workerName=node0
542021-11-19 09:41:07.474 INFO 16666 --- [ main] org.eclipse.jetty.server.session : No SessionScavenger set, using defaults
552021-11-19 09:41:07.475 INFO 16666 --- [ main] org.eclipse.jetty.server.session : node0 Scavenging every 660000ms
562021-11-19 09:41:07.480 INFO 16666 --- [ main] o.e.jetty.server.handler.ContextHandler : Started o.s.b.w.e.j.JettyEmbeddedWebAppContext@6aa3bfc{application,/,[file:///tmp/jetty-docbase.8080.2024342829220941812/, jar:file:/home/advance/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger-ui/3.0.0/1e665fbe22148f7c36fa8a08e515a0047cd4390b/springfox-swagger-ui-3.0.0.jar!/META-INF/resources],AVAILABLE}
572021-11-19 09:41:07.480 INFO 16666 --- [ main] org.eclipse.jetty.server.Server : Started @1318ms
582021-11-19 09:41:07.920 INFO 16666 --- [ main] o.e.j.s.h.ContextHandler.application : Initializing Spring DispatcherServlet 'dispatcherServlet'
592021-11-19 09:41:07.920 INFO 16666 --- [ main] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
602021-11-19 09:41:07.921 INFO 16666 --- [ main] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
612021-11-19 09:41:07.931 INFO 16666 --- [ main] o.e.jetty.server.AbstractConnector : Started ServerConnector@2643d762{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
622021-11-19 09:41:07.932 INFO 16666 --- [ main] o.s.b.web.embedded.jetty.JettyWebServer : Jetty started on port(s) 8080 (http/1.1) with context path '/'
632021-11-19 09:41:07.934 WARN 16666 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException: Cannot invoke "org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()" because "this.condition" is null
642021-11-19 09:41:07.949 INFO 16666 --- [ main] o.e.jetty.server.AbstractConnector : Stopped ServerConnector@2643d762{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
652021-11-19 09:41:07.950 INFO 16666 --- [ main] org.eclipse.jetty.server.session : node0 Stopped scavenging
662021-11-19 09:41:07.951 INFO 16666 --- [ main] o.e.j.s.h.ContextHandler.application : Destroying Spring FrameworkServlet 'dispatcherServlet'
672021-11-19 09:41:07.951 INFO 16666 --- [ main] o.e.jetty.server.handler.ContextHandler : Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@6aa3bfc{application,/,[file:///tmp/jetty-docbase.8080.2024342829220941812/, jar:file:/home/advance/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger-ui/3.0.0/1e665fbe22148f7c36fa8a08e515a0047cd4390b/springfox-swagger-ui-3.0.0.jar!/META-INF/resources],STOPPED}
682021-11-19 09:41:07.958 INFO 16666 --- [ main] ConditionEvaluationReportLoggingListener :
69
70Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
712021-11-19 09:41:07.970 ERROR 16666 --- [ main] o.s.boot.SpringApplication : Application run failed
72
73org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException: Cannot invoke "org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()" because "this.condition" is null
74 at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.13.jar:5.3.13]
75 at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.13.jar:5.3.13]
76 at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.13.jar:5.3.13]
77 at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
78 at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.13.jar:5.3.13]
79 at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.13.jar:5.3.13]
80 at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.13.jar:5.3.13]
81 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.13.jar:5.3.13]
82 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.0.jar:2.6.0]
83 at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-2.6.0.jar:2.6.0]
84 at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) ~[spring-boot-2.6.0.jar:2.6.0]
85 at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) ~[spring-boot-2.6.0.jar:2.6.0]
86 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.0.jar:2.6.0]
87 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290) ~[spring-boot-2.6.0.jar:2.6.0]
88 at com.example.springfox.SpringFoxApplication.main(SpringFoxApplication.java:10) ~[main/:na]
89Caused by: java.lang.NullPointerException: Cannot invoke "org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()" because "this.condition" is null
90 at springfox.documentation.spring.web.WebMvcPatternsRequestConditionWrapper.getPatterns(WebMvcPatternsRequestConditionWrapper.java:56) ~[springfox-spring-webmvc-3.0.0.jar:3.0.0]
91 at springfox.documentation.RequestHandler.sortedPaths(RequestHandler.java:113) ~[springfox-core-3.0.0.jar:3.0.0]
92 at springfox.documentation.spi.service.contexts.Orderings.lambda$byPatternsCondition$3(Orderings.java:89) ~[springfox-spi-3.0.0.jar:3.0.0]
93 at java.base/java.util.Comparator.lambda$comparing$77a9974f$1(Comparator.java:469) ~[na:na]
94 at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) ~[na:na]
95 at java.base/java.util.TimSort.sort(TimSort.java:220) ~[na:na]
96 at java.base/java.util.Arrays.sort(Arrays.java:1306) ~[na:na]
97 at java.base/java.util.ArrayList.sort(ArrayList.java:1721) ~[na:na]
98 at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:392) ~[na:na]
99 at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
100 at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
101 at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
102 at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
103 at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) ~[na:na]
104 at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
105 at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
106 at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
107 at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
108 at springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider.requestHandlers(WebMvcRequestHandlerProvider.java:81) ~[springfox-spring-webmvc-3.0.0.jar:3.0.0]
109 at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
110 at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[na:na]
111 at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
112 at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
113 at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
114 at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
115 at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
116 at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.withDefaults(AbstractDocumentationPluginsBootstrapper.java:107) ~[springfox-spring-web-3.0.0.jar:3.0.0]
117 at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.buildContext(AbstractDocumentationPluginsBootstrapper.java:91) ~[springfox-spring-web-3.0.0.jar:3.0.0]
118 at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.bootstrapDocumentationPlugins(AbstractDocumentationPluginsBootstrapper.java:82) ~[springfox-spring-web-3.0.0.jar:3.0.0]
119 at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:100) ~[springfox-spring-web-3.0.0.jar:3.0.0]
120 at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.13.jar:5.3.13]
121 ... 14 common frames omitted
122
123
124FAILURE: Build failed with an exception.
125
126* What went wrong:
127Execution failed for task ':bootRun'.
128> Process 'command '/home/advance/.sdkman/candidates/java/15.0.2-open/bin/java'' finished with non-zero exit value 1
129
130* Try:
131Run 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.
132
133* Get more help at https://help.gradle.org
134
135Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
136Use '--warning-mode all' to show the individual deprecation warnings.
137See https://docs.gradle.org/6.9.1/userguide/command_line_interface.html#sec:command_line_warnings
138
139BUILD FAILED in 2s
1405 actionable tasks: 5 executed
141
Does anyone have an idea how to solve it?
ANSWER
Answered 2022-Feb-08 at 12:36This problem's caused by a bug in Springfox. It's making an assumption about how Spring MVC is set up that doesn't always hold true. Specifically, it's assuming that MVC's path matching will use the Ant-based path matcher and not the PathPattern-based matcher. PathPattern-based matching has been an option for some time now and is the default as of Spring Boot 2.6.
As described in Spring Boot 2.6's release notes, you can restore the configuration that Springfox assumes will be used by setting spring.mvc.pathmatch.matching-strategy
to ant-path-matcher
in your application.properties
file. Note that this will only work if you are not using Spring Boot's Actuator. The Actuator always uses PathPattern-based parsing, irrespective of the configured matching-strategy
. A change to Springfox will be required if you want to use it with the Actuator in Spring Boot 2.6 and later.
QUESTION
Your project requires a newer version of the Kotlin Gradle plugin. (Android Studio)
Asked 2022-Mar-17 at 15:50I've just updated my flutter project packages to be null-safety compliant and now Android Studio wants me to update my project to use the latest version of Kotling Gradle Plugin. Can't see where to change this though. I have tried to change "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
into "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10"
but this has no effect.
My build.grade
-file looks like this:
1def localProperties = new Properties()
2def localPropertiesFile = rootProject.file('local.properties')
3if (localPropertiesFile.exists()) {
4 localPropertiesFile.withReader('UTF-8') { reader ->
5 localProperties.load(reader)
6 }
7}
8
9def flutterRoot = localProperties.getProperty('flutter.sdk')
10if (flutterRoot == null) {
11 throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12}
13
14def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15if (flutterVersionCode == null) {
16 flutterVersionCode = '1'
17}
18
19def flutterVersionName = localProperties.getProperty('flutter.versionName')
20if (flutterVersionName == null) {
21 flutterVersionName = '1.0'
22}
23
24apply plugin: 'com.android.application'
25apply plugin: 'kotlin-android'
26apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27
28def keystoreProperties = new Properties()
29def keystorePropertiesFile = rootProject.file('key.properties')
30if (keystorePropertiesFile.exists()) {
31 keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
32}
33
34android {
35 compileSdkVersion 31
36
37 sourceSets {
38 main.java.srcDirs += 'src/main/kotlin'
39 }
40
41 lintOptions {
42 disable 'InvalidPackage'
43 }
44
45 defaultConfig {
46 // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 applicationId "*********"
48 minSdkVersion 30
49 targetSdkVersion 30
50 versionCode flutterVersionCode.toInteger()
51 versionName flutterVersionName
52 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
53 }
54
55
56
57 signingConfigs {
58 release {
59 keyAlias keystoreProperties['keyAlias']
60 keyPassword keystoreProperties['keyPassword']
61 storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
62 storePassword keystoreProperties['storePassword']
63 }
64 }
65 buildTypes {
66 release {
67 signingConfig signingConfigs.release
68 }
69 }
70
71}
72
73flutter {
74 source '../..'
75}
76
77dependencies {
78 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
79 testImplementation 'junit:junit:4.12'
80 androidTestImplementation 'androidx.test:runner:1.1.1'
81 androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
82 implementation 'com.google.firebase:firebase-analytics:17.2.2'
83}
84apply plugin: 'com.google.gms.google-services'
85
Build output:
1def localProperties = new Properties()
2def localPropertiesFile = rootProject.file('local.properties')
3if (localPropertiesFile.exists()) {
4 localPropertiesFile.withReader('UTF-8') { reader ->
5 localProperties.load(reader)
6 }
7}
8
9def flutterRoot = localProperties.getProperty('flutter.sdk')
10if (flutterRoot == null) {
11 throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12}
13
14def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15if (flutterVersionCode == null) {
16 flutterVersionCode = '1'
17}
18
19def flutterVersionName = localProperties.getProperty('flutter.versionName')
20if (flutterVersionName == null) {
21 flutterVersionName = '1.0'
22}
23
24apply plugin: 'com.android.application'
25apply plugin: 'kotlin-android'
26apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27
28def keystoreProperties = new Properties()
29def keystorePropertiesFile = rootProject.file('key.properties')
30if (keystorePropertiesFile.exists()) {
31 keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
32}
33
34android {
35 compileSdkVersion 31
36
37 sourceSets {
38 main.java.srcDirs += 'src/main/kotlin'
39 }
40
41 lintOptions {
42 disable 'InvalidPackage'
43 }
44
45 defaultConfig {
46 // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 applicationId "*********"
48 minSdkVersion 30
49 targetSdkVersion 30
50 versionCode flutterVersionCode.toInteger()
51 versionName flutterVersionName
52 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
53 }
54
55
56
57 signingConfigs {
58 release {
59 keyAlias keystoreProperties['keyAlias']
60 keyPassword keystoreProperties['keyPassword']
61 storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
62 storePassword keystoreProperties['storePassword']
63 }
64 }
65 buildTypes {
66 release {
67 signingConfig signingConfigs.release
68 }
69 }
70
71}
72
73flutter {
74 source '../..'
75}
76
77dependencies {
78 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
79 testImplementation 'junit:junit:4.12'
80 androidTestImplementation 'androidx.test:runner:1.1.1'
81 androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
82 implementation 'com.google.firebase:firebase-analytics:17.2.2'
83}
84apply plugin: 'com.google.gms.google-services'
85BUILD FAILED in 8s
86[!] Your project requires a newer version of the Kotlin Gradle plugin.
87 Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update project/android/build.gradle:
88 ext.kotlin_version = '<latest-version>'
89Exception: Gradle task assembleDebug failed with exit code 1
90
ANSWER
Answered 2022-Jan-30 at 21:52change build gradle to this :
1def localProperties = new Properties()
2def localPropertiesFile = rootProject.file('local.properties')
3if (localPropertiesFile.exists()) {
4 localPropertiesFile.withReader('UTF-8') { reader ->
5 localProperties.load(reader)
6 }
7}
8
9def flutterRoot = localProperties.getProperty('flutter.sdk')
10if (flutterRoot == null) {
11 throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12}
13
14def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15if (flutterVersionCode == null) {
16 flutterVersionCode = '1'
17}
18
19def flutterVersionName = localProperties.getProperty('flutter.versionName')
20if (flutterVersionName == null) {
21 flutterVersionName = '1.0'
22}
23
24apply plugin: 'com.android.application'
25apply plugin: 'kotlin-android'
26apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27
28def keystoreProperties = new Properties()
29def keystorePropertiesFile = rootProject.file('key.properties')
30if (keystorePropertiesFile.exists()) {
31 keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
32}
33
34android {
35 compileSdkVersion 31
36
37 sourceSets {
38 main.java.srcDirs += 'src/main/kotlin'
39 }
40
41 lintOptions {
42 disable 'InvalidPackage'
43 }
44
45 defaultConfig {
46 // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 applicationId "*********"
48 minSdkVersion 30
49 targetSdkVersion 30
50 versionCode flutterVersionCode.toInteger()
51 versionName flutterVersionName
52 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
53 }
54
55
56
57 signingConfigs {
58 release {
59 keyAlias keystoreProperties['keyAlias']
60 keyPassword keystoreProperties['keyPassword']
61 storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
62 storePassword keystoreProperties['storePassword']
63 }
64 }
65 buildTypes {
66 release {
67 signingConfig signingConfigs.release
68 }
69 }
70
71}
72
73flutter {
74 source '../..'
75}
76
77dependencies {
78 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
79 testImplementation 'junit:junit:4.12'
80 androidTestImplementation 'androidx.test:runner:1.1.1'
81 androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
82 implementation 'com.google.firebase:firebase-analytics:17.2.2'
83}
84apply plugin: 'com.google.gms.google-services'
85BUILD FAILED in 8s
86[!] Your project requires a newer version of the Kotlin Gradle plugin.
87 Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update project/android/build.gradle:
88 ext.kotlin_version = '<latest-version>'
89Exception: Gradle task assembleDebug failed with exit code 1
90classpath 'com.android.tools.build:gradle:4.1.0'
91
and gradle-wrapper to this :
1def localProperties = new Properties()
2def localPropertiesFile = rootProject.file('local.properties')
3if (localPropertiesFile.exists()) {
4 localPropertiesFile.withReader('UTF-8') { reader ->
5 localProperties.load(reader)
6 }
7}
8
9def flutterRoot = localProperties.getProperty('flutter.sdk')
10if (flutterRoot == null) {
11 throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12}
13
14def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15if (flutterVersionCode == null) {
16 flutterVersionCode = '1'
17}
18
19def flutterVersionName = localProperties.getProperty('flutter.versionName')
20if (flutterVersionName == null) {
21 flutterVersionName = '1.0'
22}
23
24apply plugin: 'com.android.application'
25apply plugin: 'kotlin-android'
26apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27
28def keystoreProperties = new Properties()
29def keystorePropertiesFile = rootProject.file('key.properties')
30if (keystorePropertiesFile.exists()) {
31 keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
32}
33
34android {
35 compileSdkVersion 31
36
37 sourceSets {
38 main.java.srcDirs += 'src/main/kotlin'
39 }
40
41 lintOptions {
42 disable 'InvalidPackage'
43 }
44
45 defaultConfig {
46 // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 applicationId "*********"
48 minSdkVersion 30
49 targetSdkVersion 30
50 versionCode flutterVersionCode.toInteger()
51 versionName flutterVersionName
52 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
53 }
54
55
56
57 signingConfigs {
58 release {
59 keyAlias keystoreProperties['keyAlias']
60 keyPassword keystoreProperties['keyPassword']
61 storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
62 storePassword keystoreProperties['storePassword']
63 }
64 }
65 buildTypes {
66 release {
67 signingConfig signingConfigs.release
68 }
69 }
70
71}
72
73flutter {
74 source '../..'
75}
76
77dependencies {
78 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
79 testImplementation 'junit:junit:4.12'
80 androidTestImplementation 'androidx.test:runner:1.1.1'
81 androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
82 implementation 'com.google.firebase:firebase-analytics:17.2.2'
83}
84apply plugin: 'com.google.gms.google-services'
85BUILD FAILED in 8s
86[!] Your project requires a newer version of the Kotlin Gradle plugin.
87 Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update project/android/build.gradle:
88 ext.kotlin_version = '<latest-version>'
89Exception: Gradle task assembleDebug failed with exit code 1
90classpath 'com.android.tools.build:gradle:4.1.0'
91distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
92
QUESTION
ESlint - Error: Must use import to load ES Module
Asked 2022-Mar-17 at 12:13I am currently setting up a boilerplate with React, Typescript, styled components, webpack etc. and I am getting an error when trying to run eslint:
Error: Must use import to load ES Module
Here is a more verbose version of the error:
1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2 0:0 error Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6
The error occurs in every single one of my .js and .ts/ .tsx files where I only use import
or the file doesn't even have an import at all. I understand what the error is saying but I have no idea why it is being thrown when in fact I only use imports or even no imports at all in some files.
Here is my package.json where I trigger the linter from using npm run lint:eslint:quiet
:
1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2 0:0 error Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6{
7 "name": "my-react-boilerplate",
8 "version": "1.0.0",
9 "description": "",
10 "main": "index.tsx",
11 "directories": {
12 "test": "test"
13 },
14 "engines": {
15 "node": ">=14.0.0"
16 },
17 "type": "module",
18 "scripts": {
19 "build": "webpack --config webpack.prod.js",
20 "dev": "webpack serve --config webpack.dev.js",
21 "lint": "npm run typecheck && npm run lint:css && npm run lint:eslint:quiet",
22 "lint:css": "stylelint './src/**/*.{js,ts,tsx}'",
23 "lint:eslint:quiet": "eslint --ext .ts,.tsx,.js,.jsx ./src --no-error-on-unmatched-pattern --quiet",
24 "lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx ./src --no-error-on-unmatched-pattern",
25 "lint:eslint:fix": "eslint --ext .ts,.tsx,.js,.jsx ./src --no-error-on-unmatched-pattern --quiet --fix",
26 "test": "cross-env NODE_ENV=test jest --coverage",
27 "test:watch": "cross-env NODE_ENV=test jest --watchAll",
28 "typecheck": "tsc --noEmit",
29 "precommit": "npm run lint"
30 },
31 "lint-staged": {
32 "*.{ts,tsx,js,jsx}": [
33 "npm run lint:eslint:fix",
34 "git add --force"
35 ],
36 "*.{md,json}": [
37 "prettier --write",
38 "git add --force"
39 ]
40 },
41 "husky": {
42 "hooks": {
43 "pre-commit": "npx lint-staged && npm run typecheck"
44 }
45 },
46 "resolutions": {
47 "styled-components": "^5"
48 },
49 "author": "",
50 "license": "ISC",
51 "devDependencies": {
52 "@babel/core": "^7.5.4",
53 "@babel/plugin-proposal-class-properties": "^7.5.0",
54 "@babel/preset-env": "^7.5.4",
55 "@babel/preset-react": "^7.0.0",
56 "@types/history": "^4.7.6",
57 "@types/react": "^17.0.29",
58 "@types/react-dom": "^17.0.9",
59 "@types/react-router": "^5.1.17",
60 "@types/react-router-dom": "^5.1.5",
61 "@types/styled-components": "^5.1.15",
62 "@typescript-eslint/eslint-plugin": "^5.0.0",
63 "babel-cli": "^6.26.0",
64 "babel-eslint": "^10.0.2",
65 "babel-loader": "^8.0.0-beta.6",
66 "babel-polyfill": "^6.26.0",
67 "babel-preset-env": "^1.7.0",
68 "babel-preset-react": "^6.24.1",
69 "babel-preset-stage-2": "^6.24.1",
70 "clean-webpack-plugin": "^4.0.0",
71 "dotenv-webpack": "^7.0.3",
72 "error-overlay-webpack-plugin": "^1.0.0",
73 "eslint": "^8.0.0",
74 "eslint-config-airbnb": "^18.2.0",
75 "eslint-config-prettier": "^8.3.0",
76 "eslint-config-with-prettier": "^6.0.0",
77 "eslint-plugin-compat": "^3.3.0",
78 "eslint-plugin-import": "^2.25.2",
79 "eslint-plugin-jsx-a11y": "^6.2.3",
80 "eslint-plugin-prettier": "^4.0.0",
81 "eslint-plugin-react": "^7.14.2",
82 "eslint-plugin-react-hooks": "^4.2.0",
83 "extract-text-webpack-plugin": "^3.0.2",
84 "file-loader": "^6.2.0",
85 "html-webpack-plugin": "^5.3.2",
86 "husky": "^7.0.2",
87 "prettier": "^2.4.1",
88 "raw-loader": "^4.0.2",
89 "style-loader": "^3.3.0",
90 "stylelint": "^13.13.1",
91 "stylelint-config-recommended": "^5.0.0",
92 "stylelint-config-styled-components": "^0.1.1",
93 "stylelint-processor-styled-components": "^1.10.0",
94 "ts-loader": "^9.2.6",
95 "tslint": "^6.1.3",
96 "typescript": "^4.4.4",
97 "url-loader": "^4.1.1",
98 "webpack": "^5.58.2",
99 "webpack-cli": "^4.2.0",
100 "webpack-dev-server": "^4.3.1",
101 "webpack-merge": "^5.3.0"
102 },
103 "dependencies": {
104 "history": "^4.10.0",
105 "process": "^0.11.10",
106 "react": "^17.0.1",
107 "react-dom": "^17.0.1",
108 "react-router-dom": "^5.2.0",
109 "styled-components": "^5.2.1"
110 }
111}
112
Here is my .eslintrc file:
1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2 0:0 error Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6{
7 "name": "my-react-boilerplate",
8 "version": "1.0.0",
9 "description": "",
10 "main": "index.tsx",
11 "directories": {
12 "test": "test"
13 },
14 "engines": {
15 "node": ">=14.0.0"
16 },
17 "type": "module",
18 "scripts": {
19 "build": "webpack --config webpack.prod.js",
20 "dev": "webpack serve --config webpack.dev.js",
21 "lint": "npm run typecheck && npm run lint:css && npm run lint:eslint:quiet",
22 "lint:css": "stylelint './src/**/*.{js,ts,tsx}'",
23 "lint:eslint:quiet": "eslint --ext .ts,.tsx,.js,.jsx ./src --no-error-on-unmatched-pattern --quiet",
24 "lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx ./src --no-error-on-unmatched-pattern",
25 "lint:eslint:fix": "eslint --ext .ts,.tsx,.js,.jsx ./src --no-error-on-unmatched-pattern --quiet --fix",
26 "test": "cross-env NODE_ENV=test jest --coverage",
27 "test:watch": "cross-env NODE_ENV=test jest --watchAll",
28 "typecheck": "tsc --noEmit",
29 "precommit": "npm run lint"
30 },
31 "lint-staged": {
32 "*.{ts,tsx,js,jsx}": [
33 "npm run lint:eslint:fix",
34 "git add --force"
35 ],
36 "*.{md,json}": [
37 "prettier --write",
38 "git add --force"
39 ]
40 },
41 "husky": {
42 "hooks": {
43 "pre-commit": "npx lint-staged && npm run typecheck"
44 }
45 },
46 "resolutions": {
47 "styled-components": "^5"
48 },
49 "author": "",
50 "license": "ISC",
51 "devDependencies": {
52 "@babel/core": "^7.5.4",
53 "@babel/plugin-proposal-class-properties": "^7.5.0",
54 "@babel/preset-env": "^7.5.4",
55 "@babel/preset-react": "^7.0.0",
56 "@types/history": "^4.7.6",
57 "@types/react": "^17.0.29",
58 "@types/react-dom": "^17.0.9",
59 "@types/react-router": "^5.1.17",
60 "@types/react-router-dom": "^5.1.5",
61 "@types/styled-components": "^5.1.15",
62 "@typescript-eslint/eslint-plugin": "^5.0.0",
63 "babel-cli": "^6.26.0",
64 "babel-eslint": "^10.0.2",
65 "babel-loader": "^8.0.0-beta.6",
66 "babel-polyfill": "^6.26.0",
67 "babel-preset-env": "^1.7.0",
68 "babel-preset-react": "^6.24.1",
69 "babel-preset-stage-2": "^6.24.1",
70 "clean-webpack-plugin": "^4.0.0",
71 "dotenv-webpack": "^7.0.3",
72 "error-overlay-webpack-plugin": "^1.0.0",
73 "eslint": "^8.0.0",
74 "eslint-config-airbnb": "^18.2.0",
75 "eslint-config-prettier": "^8.3.0",
76 "eslint-config-with-prettier": "^6.0.0",
77 "eslint-plugin-compat": "^3.3.0",
78 "eslint-plugin-import": "^2.25.2",
79 "eslint-plugin-jsx-a11y": "^6.2.3",
80 "eslint-plugin-prettier": "^4.0.0",
81 "eslint-plugin-react": "^7.14.2",
82 "eslint-plugin-react-hooks": "^4.2.0",
83 "extract-text-webpack-plugin": "^3.0.2",
84 "file-loader": "^6.2.0",
85 "html-webpack-plugin": "^5.3.2",
86 "husky": "^7.0.2",
87 "prettier": "^2.4.1",
88 "raw-loader": "^4.0.2",
89 "style-loader": "^3.3.0",
90 "stylelint": "^13.13.1",
91 "stylelint-config-recommended": "^5.0.0",
92 "stylelint-config-styled-components": "^0.1.1",
93 "stylelint-processor-styled-components": "^1.10.0",
94 "ts-loader": "^9.2.6",
95 "tslint": "^6.1.3",
96 "typescript": "^4.4.4",
97 "url-loader": "^4.1.1",
98 "webpack": "^5.58.2",
99 "webpack-cli": "^4.2.0",
100 "webpack-dev-server": "^4.3.1",
101 "webpack-merge": "^5.3.0"
102 },
103 "dependencies": {
104 "history": "^4.10.0",
105 "process": "^0.11.10",
106 "react": "^17.0.1",
107 "react-dom": "^17.0.1",
108 "react-router-dom": "^5.2.0",
109 "styled-components": "^5.2.1"
110 }
111}
112{
113 "extends": ["airbnb", "prettier"],
114 "parser": "babel-eslint",
115 "plugins": ["prettier", "@typescript-eslint"],
116 "parserOptions": {
117 "ecmaVersion": 8,
118 "ecmaFeatures": {
119 "experimentalObjectRestSpread": true,
120 "impliedStrict": true,
121 "classes": true
122 }
123 },
124 "env": {
125 "browser": true,
126 "node": true,
127 "jest": true
128 },
129 "rules": {
130 "arrow-body-style": ["error", "as-needed"],
131 "class-methods-use-this": 0,
132 "react/jsx-filename-extension": 0,
133 "global-require": 0,
134 "react/destructuring-assignment": 0,
135 "import/named": 2,
136 "linebreak-style": 0,
137 "import/no-dynamic-require": 0,
138 "import/no-named-as-default": 0,
139 "import/no-unresolved": 2,
140 "import/prefer-default-export": 0,
141 "semi": [2, "always"],
142 "max-len": [
143 "error",
144 {
145 "code": 80,
146 "ignoreUrls": true,
147 "ignoreComments": true,
148 "ignoreStrings": true,
149 "ignoreTemplateLiterals": true
150 }
151 ],
152 "new-cap": [
153 2,
154 {
155 "capIsNew": false,
156 "newIsCap": true
157 }
158 ],
159 "no-param-reassign": 0,
160 "no-shadow": 0,
161 "no-tabs": 2,
162 "no-underscore-dangle": 0,
163 "react/forbid-prop-types": [
164 "error",
165 {
166 "forbid": ["any"]
167 }
168 ],
169 "import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
170 "react/jsx-no-bind": [
171 "error",
172 {
173 "ignoreRefs": true,
174 "allowArrowFunctions": true,
175 "allowBind": false
176 }
177 ],
178 "react/no-unknown-property": [
179 2,
180 {
181 "ignore": ["itemscope", "itemtype", "itemprop"]
182 }
183 ]
184 }
185}
186
And i'm not sure if relevant but also my tsconfig.eslint.json file:
1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2 0:0 error Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6{
7 "name": "my-react-boilerplate",
8 "version": "1.0.0",
9 "description": "",
10 "main": "index.tsx",
11 "directories": {
12 "test": "test"
13 },
14 "engines": {
15 "node": ">=14.0.0"
16 },
17 "type": "module",
18 "scripts": {
19 "build": "webpack --config webpack.prod.js",
20 "dev": "webpack serve --config webpack.dev.js",
21 "lint": "npm run typecheck && npm run lint:css && npm run lint:eslint:quiet",
22 "lint:css": "stylelint './src/**/*.{js,ts,tsx}'",
23 "lint:eslint:quiet": "eslint --ext .ts,.tsx,.js,.jsx ./src --no-error-on-unmatched-pattern --quiet",
24 "lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx ./src --no-error-on-unmatched-pattern",
25 "lint:eslint:fix": "eslint --ext .ts,.tsx,.js,.jsx ./src --no-error-on-unmatched-pattern --quiet --fix",
26 "test": "cross-env NODE_ENV=test jest --coverage",
27 "test:watch": "cross-env NODE_ENV=test jest --watchAll",
28 "typecheck": "tsc --noEmit",
29 "precommit": "npm run lint"
30 },
31 "lint-staged": {
32 "*.{ts,tsx,js,jsx}": [
33 "npm run lint:eslint:fix",
34 "git add --force"
35 ],
36 "*.{md,json}": [
37 "prettier --write",
38 "git add --force"
39 ]
40 },
41 "husky": {
42 "hooks": {
43 "pre-commit": "npx lint-staged && npm run typecheck"
44 }
45 },
46 "resolutions": {
47 "styled-components": "^5"
48 },
49 "author": "",
50 "license": "ISC",
51 "devDependencies": {
52 "@babel/core": "^7.5.4",
53 "@babel/plugin-proposal-class-properties": "^7.5.0",
54 "@babel/preset-env": "^7.5.4",
55 "@babel/preset-react": "^7.0.0",
56 "@types/history": "^4.7.6",
57 "@types/react": "^17.0.29",
58 "@types/react-dom": "^17.0.9",
59 "@types/react-router": "^5.1.17",
60 "@types/react-router-dom": "^5.1.5",
61 "@types/styled-components": "^5.1.15",
62 "@typescript-eslint/eslint-plugin": "^5.0.0",
63 "babel-cli": "^6.26.0",
64 "babel-eslint": "^10.0.2",
65 "babel-loader": "^8.0.0-beta.6",
66 "babel-polyfill": "^6.26.0",
67 "babel-preset-env": "^1.7.0",
68 "babel-preset-react": "^6.24.1",
69 "babel-preset-stage-2": "^6.24.1",
70 "clean-webpack-plugin": "^4.0.0",
71 "dotenv-webpack": "^7.0.3",
72 "error-overlay-webpack-plugin": "^1.0.0",
73 "eslint": "^8.0.0",
74 "eslint-config-airbnb": "^18.2.0",
75 "eslint-config-prettier": "^8.3.0",
76 "eslint-config-with-prettier": "^6.0.0",
77 "eslint-plugin-compat": "^3.3.0",
78 "eslint-plugin-import": "^2.25.2",
79 "eslint-plugin-jsx-a11y": "^6.2.3",
80 "eslint-plugin-prettier": "^4.0.0",
81 "eslint-plugin-react": "^7.14.2",
82 "eslint-plugin-react-hooks": "^4.2.0",
83 "extract-text-webpack-plugin": "^3.0.2",
84 "file-loader": "^6.2.0",
85 "html-webpack-plugin": "^5.3.2",
86 "husky": "^7.0.2",
87 "prettier": "^2.4.1",
88 "raw-loader": "^4.0.2",
89 "style-loader": "^3.3.0",
90 "stylelint": "^13.13.1",
91 "stylelint-config-recommended": "^5.0.0",
92 "stylelint-config-styled-components": "^0.1.1",
93 "stylelint-processor-styled-components": "^1.10.0",
94 "ts-loader": "^9.2.6",
95 "tslint": "^6.1.3",
96 "typescript": "^4.4.4",
97 "url-loader": "^4.1.1",
98 "webpack": "^5.58.2",
99 "webpack-cli": "^4.2.0",
100 "webpack-dev-server": "^4.3.1",
101 "webpack-merge": "^5.3.0"
102 },
103 "dependencies": {
104 "history": "^4.10.0",
105 "process": "^0.11.10",
106 "react": "^17.0.1",
107 "react-dom": "^17.0.1",
108 "react-router-dom": "^5.2.0",
109 "styled-components": "^5.2.1"
110 }
111}
112{
113 "extends": ["airbnb", "prettier"],
114 "parser": "babel-eslint",
115 "plugins": ["prettier", "@typescript-eslint"],
116 "parserOptions": {
117 "ecmaVersion": 8,
118 "ecmaFeatures": {
119 "experimentalObjectRestSpread": true,
120 "impliedStrict": true,
121 "classes": true
122 }
123 },
124 "env": {
125 "browser": true,
126 "node": true,
127 "jest": true
128 },
129 "rules": {
130 "arrow-body-style": ["error", "as-needed"],
131 "class-methods-use-this": 0,
132 "react/jsx-filename-extension": 0,
133 "global-require": 0,
134 "react/destructuring-assignment": 0,
135 "import/named": 2,
136 "linebreak-style": 0,
137 "import/no-dynamic-require": 0,
138 "import/no-named-as-default": 0,
139 "import/no-unresolved": 2,
140 "import/prefer-default-export": 0,
141 "semi": [2, "always"],
142 "max-len": [
143 "error",
144 {
145 "code": 80,
146 "ignoreUrls": true,
147 "ignoreComments": true,
148 "ignoreStrings": true,
149 "ignoreTemplateLiterals": true
150 }
151 ],
152 "new-cap": [
153 2,
154 {
155 "capIsNew": false,
156 "newIsCap": true
157 }
158 ],
159 "no-param-reassign": 0,
160 "no-shadow": 0,
161 "no-tabs": 2,
162 "no-underscore-dangle": 0,
163 "react/forbid-prop-types": [
164 "error",
165 {
166 "forbid": ["any"]
167 }
168 ],
169 "import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
170 "react/jsx-no-bind": [
171 "error",
172 {
173 "ignoreRefs": true,
174 "allowArrowFunctions": true,
175 "allowBind": false
176 }
177 ],
178 "react/no-unknown-property": [
179 2,
180 {
181 "ignore": ["itemscope", "itemtype", "itemprop"]
182 }
183 ]
184 }
185}
186{
187 "extends": "./tsconfig.json",
188 "include": ["./src/**/*.ts", "./src/**/*.tsx", "./src/**/*.js"],
189 "exclude": ["node_modules/**", "build/**", "coverage/**"]
190}
191
Not sure if anyone has come across this before? Googling the error does not present any useful forums or raised bugs, most of them just state not to use require
in your files which I am not.
ANSWER
Answered 2022-Mar-15 at 16:08I think the problem is that you are trying to use the deprecated babel-eslint parser, last updated a year ago, which looks like it doesn't support ES6 modules. Updating to the latest parser seems to work, at least for simple linting.
So, do this:
- In package.json, update the line
"babel-eslint": "^10.0.2",
to"@babel/eslint-parser": "^7.5.4",
. This works with the code above but it may be better to use the latest version, which at the time of writing is 7.16.3. - Run
npm i
from a terminal/command prompt in the folder - In .eslintrc, update the parser line
"parser": "babel-eslint",
to"parser": "@babel/eslint-parser",
- In .eslintrc, add
"requireConfigFile": false,
to the parserOptions section (underneath"ecmaVersion": 8,
) (I needed this or babel was looking for config files I don't have) - Run the command to lint a file
Then, for me with just your two configuration files, the error goes away and I get appropriate linting errors.
QUESTION
Allow insecure protocols, android gradle
Asked 2022-Mar-17 at 10:30I recently updated my android studio to Arctic Fox and got an error in my project
1A problem occurred configuring root project 'so10'.
2> Could not resolve all dependencies for configuration ':classpath'.
3 > Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository
4'maven3(http://oss.sonatype.org/content/repositories/snapshots)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols.
5 See https://docs.gradle.org/7.0.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.
6
This is my gradle where the problem occurs
1A problem occurred configuring root project 'so10'.
2> Could not resolve all dependencies for configuration ':classpath'.
3 > Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository
4'maven3(http://oss.sonatype.org/content/repositories/snapshots)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols.
5 See https://docs.gradle.org/7.0.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.
6repositories {
7 // maven { url 'https://maven.fabric.io/public' }
8 maven { url "https://jitpack.io" }
9 maven { url 'https://raw.github.com/Raizlabs/maven-releases/master/releases' }
10 maven { url 'http://oss.sonatype.org/content/repositories/snapshots'}
11 maven { url "https://plugins.gradle.org/m2/" }
12 maven { url 'https://maven.google.com' }
13 google()
14 mavenCentral()
15 jcenter()
16}
17
How do I solve it?
ANSWER
Answered 2022-Mar-17 at 10:30For insecure HTTP connections in Gradle 7+ versions, we need to specify a boolean allowInsecureProtocol as true to MavenArtifactRepository
closure.
Since you have received this error for sonatype
repository, you need to set the repositories as below:
- Groovy DSL
1A problem occurred configuring root project 'so10'.
2> Could not resolve all dependencies for configuration ':classpath'.
3 > Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository
4'maven3(http://oss.sonatype.org/content/repositories/snapshots)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols.
5 See https://docs.gradle.org/7.0.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.
6repositories {
7 // maven { url 'https://maven.fabric.io/public' }
8 maven { url "https://jitpack.io" }
9 maven { url 'https://raw.github.com/Raizlabs/maven-releases/master/releases' }
10 maven { url 'http://oss.sonatype.org/content/repositories/snapshots'}
11 maven { url "https://plugins.gradle.org/m2/" }
12 maven { url 'https://maven.google.com' }
13 google()
14 mavenCentral()
15 jcenter()
16}
17repositories {
18 maven {
19 url "http://oss.sonatype.org/content/repositories/snapshots"
20 allowInsecureProtocol = true
21 }
22 // other repositories ...
23}
24
- Kotlin DSL
1A problem occurred configuring root project 'so10'.
2> Could not resolve all dependencies for configuration ':classpath'.
3 > Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository
4'maven3(http://oss.sonatype.org/content/repositories/snapshots)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols.
5 See https://docs.gradle.org/7.0.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.
6repositories {
7 // maven { url 'https://maven.fabric.io/public' }
8 maven { url "https://jitpack.io" }
9 maven { url 'https://raw.github.com/Raizlabs/maven-releases/master/releases' }
10 maven { url 'http://oss.sonatype.org/content/repositories/snapshots'}
11 maven { url "https://plugins.gradle.org/m2/" }
12 maven { url 'https://maven.google.com' }
13 google()
14 mavenCentral()
15 jcenter()
16}
17repositories {
18 maven {
19 url "http://oss.sonatype.org/content/repositories/snapshots"
20 allowInsecureProtocol = true
21 }
22 // other repositories ...
23}
24repositories {
25 maven {
26 url = uri("http://oss.sonatype.org/content/repositories/snapshots")
27 isAllowInsecureProtocol = true
28 }
29 // other repositories ...
30}
31
QUESTION
How did print(*a, a.pop(0)) change?
Asked 2022-Feb-04 at 21:21This code:
1a = [1, 2, 3]
2print(*a, a.pop(0))
3
Python 3.8 prints 2 3 1
(does the pop
before unpacking).
Python 3.9 prints 1 2 3 1
(does the pop
after unpacking).
What caused the change? I didn't find it in the changelog.
Edit: Not just in function calls but also for example in a list display:
1a = [1, 2, 3]
2print(*a, a.pop(0))
3a = [1, 2, 3]
4b = [*a, a.pop(0)]
5print(b)
6
Prints [2, 3, 1]
vs [1, 2, 3, 1]
. And Expression lists says "The expressions are evaluated from left to right" (that's the link to Python 3.8 documentation), so I'd expect the unpacking expression to happen first.
ANSWER
Answered 2022-Feb-04 at 21:21I suspect this may have been an accident, though I prefer the new behavior.
The new behavior is a consequence of a change to how the bytecode for *
arguments works. The change is in the changelog under Python 3.9.0 alpha 3:
bpo-39320: Replace four complex bytecodes for building sequences with three simpler ones.
The following four bytecodes have been removed:
- BUILD_LIST_UNPACK
- BUILD_TUPLE_UNPACK
- BUILD_SET_UNPACK
- BUILD_TUPLE_UNPACK_WITH_CALL
The following three bytecodes have been added:
- LIST_TO_TUPLE
- LIST_EXTEND
- SET_UPDATE
On Python 3.8, the bytecode for f(*a, a.pop())
looks like this:
1a = [1, 2, 3]
2print(*a, a.pop(0))
3a = [1, 2, 3]
4b = [*a, a.pop(0)]
5print(b)
6 1 0 LOAD_NAME 0 (f)
7 2 LOAD_NAME 1 (a)
8 4 LOAD_NAME 1 (a)
9 6 LOAD_METHOD 2 (pop)
10 8 CALL_METHOD 0
11 10 BUILD_TUPLE 1
12 12 BUILD_TUPLE_UNPACK_WITH_CALL 2
13 14 CALL_FUNCTION_EX 0
14 16 RETURN_VALUE
15
while on 3.9, it looks like this:
1a = [1, 2, 3]
2print(*a, a.pop(0))
3a = [1, 2, 3]
4b = [*a, a.pop(0)]
5print(b)
6 1 0 LOAD_NAME 0 (f)
7 2 LOAD_NAME 1 (a)
8 4 LOAD_NAME 1 (a)
9 6 LOAD_METHOD 2 (pop)
10 8 CALL_METHOD 0
11 10 BUILD_TUPLE 1
12 12 BUILD_TUPLE_UNPACK_WITH_CALL 2
13 14 CALL_FUNCTION_EX 0
14 16 RETURN_VALUE
15 1 0 LOAD_NAME 0 (f)
16 2 BUILD_LIST 0
17 4 LOAD_NAME 1 (a)
18 6 LIST_EXTEND 1
19 8 LOAD_NAME 1 (a)
20 10 LOAD_METHOD 2 (pop)
21 12 CALL_METHOD 0
22 14 LIST_APPEND 1
23 16 LIST_TO_TUPLE
24 18 CALL_FUNCTION_EX 0
25 20 RETURN_VALUE
26
In the old bytecode, the code pushes a
and (a.pop(),)
onto the stack, then unpacks those two iterables into a tuple. In the new bytecode, the code pushes a list onto the stack, then does l.extend(a)
and l.append(a.pop())
, then calls tuple(l)
.
This change has the effect of shifting the unpacking of a
to before the pop
call, but this doesn't seem to have been deliberate. Looking at bpo-39320, the intent was to simplify the bytecode instructions, not to change the behavior, and the bpo thread has no discussion of behavior changes.
QUESTION
Log4j vulnerability - Is Log4j 1.2.17 vulnerable (was unable to find any JNDI code in source)?
Asked 2022-Feb-01 at 15:47With regard to the Log4j JNDI remote code execution vulnerability that has been identified CVE-2021-44228 - (also see references) - I wondered if Log4j-v1.2 is also impacted, but the closest I got from source code review is the JMS-Appender.
The question is, while the posts on the Internet indicate that Log4j 1.2 is also vulnerable, I am not able to find the relevant source code for it.
Am I missing something that others have identified?
Log4j 1.2 appears to have a vulnerability in the socket-server class, but my understanding is that it needs to be enabled in the first place for it to be applicable and hence is not a passive threat unlike the JNDI-lookup vulnerability which the one identified appears to be.
Is my understanding - that Log4j v1.2 - is not vulnerable to the jndi-remote-code execution bug correct?
ReferencesThis blog post from Cloudflare also indicates the same point as from AKX....that it was introduced from Log4j 2!
Update #1 - A fork of the (now-retired) apache-log4j-1.2.x with patch fixes for few vulnerabilities identified in the older library is now available (from the original log4j author). The site is https://reload4j.qos.ch/. As of 21-Jan-2022 version 1.2.18.2 has been released. Vulnerabilities addressed to date include those pertaining to JMSAppender, SocketServer and Chainsaw vulnerabilities. Note that I am simply relaying this information. Have not verified the fixes from my end. Please refer the link for additional details.
ANSWER
Answered 2022-Jan-01 at 18:43The JNDI feature was added into Log4j 2.0-beta9.
Log4j 1.x thus does not have the vulnerable code.
QUESTION
What's the mathematical reason behind Python choosing to round integer division toward negative infinity?
Asked 2022-Jan-30 at 01:29I know Python //
rounds towards negative infinity and in C++ /
is truncating, rounding towards 0.
And here's what I know so far:
1 |remainder|
2-12 / 10 = -1, - 2 // C++
3-12 // 10 = -2, + 8 # Python
4
512 / -10 = -1, 2 // C++
612 // -10 = -2, - 8 # Python
7
812 / 10 = 1, 2 // Both
912 // 10 = 1, 2
10
11-12 / -10 = 1, - 2 // Both
12 = 2, + 8
13
14C++:
151. m%(-n) == m%n
162. -m%n == -(m%n)
173. (m/n)*n + m%n == m
18
19Python:
201. m%(-n) == -8 == -(-m%n)
212. (m//n)*n + m%n == m
22
But why Python //
choose to round towards negative infinity? I didn't find any resources explain that, but only find and hear people say vaguely: "for mathematics reasons".
For example, in Why is -1/2 evaluated to 0 in C++, but -1 in Python?:
People dealing with these things in the abstract tend to feel that rounding toward negative infinity makes more sense (that means it's compatible with the modulo function as defined in mathematics, rather than % having a somewhat funny meaning).
But I don't see C++ 's /
not being compatible with the modulo function. In C++, (m/n)*n + m%n == m
also applies.
So what's the (mathematical) reason behind Python choosing rounding towards negative infinity?
ANSWER
Answered 2022-Jan-18 at 21:46Although I can't provide a formal definition of why/how the rounding modes were chosen as they were, the citation about compatibility with the %
operator, which you have included, does make sense when you consider that %
is not quite the same thing in C++ and Python.
In C++, it is the remainder operator, whereas, in Python, it is the modulus operator – and, when the two operands have different signs, these aren't necessarily the same thing. There are some fine explanations of the difference between these operators in the answers to: What's the difference between “mod” and “remainder”?
Now, considering this difference, the rounding (truncation) modes for integer division have to be as they are in the two languages, to ensure that the relationship you quoted, (m/n)*n + m%n == m
, remains valid.
Here are two short programs that demonstrate this in action (please forgive my somewhat naïve Python code – I'm a beginner in that language):
C++:
1 |remainder|
2-12 / 10 = -1, - 2 // C++
3-12 // 10 = -2, + 8 # Python
4
512 / -10 = -1, 2 // C++
612 // -10 = -2, - 8 # Python
7
812 / 10 = 1, 2 // Both
912 // 10 = 1, 2
10
11-12 / -10 = 1, - 2 // Both
12 = 2, + 8
13
14C++:
151. m%(-n) == m%n
162. -m%n == -(m%n)
173. (m/n)*n + m%n == m
18
19Python:
201. m%(-n) == -8 == -(-m%n)
212. (m//n)*n + m%n == m
22#include <iostream>
23
24int main()
25{
26 int dividend, divisor, quotient, remainder, check;
27 std::cout << "Enter Dividend: "; // -27
28 std::cin >> dividend;
29 std::cout << "Enter Divisor: "; // 4
30 std::cin >> divisor;
31
32 quotient = dividend / divisor;
33 std::cout << "Quotient = " << quotient << std::endl; // -6
34 remainder = dividend % divisor;
35 std::cout << "Remainder = " << remainder << std::endl; // -3
36
37 check = quotient * divisor + remainder;
38 std::cout << "Check = " << check << std::endl; // -27
39 return 0;
40}
41
Python:
1 |remainder|
2-12 / 10 = -1, - 2 // C++
3-12 // 10 = -2, + 8 # Python
4
512 / -10 = -1, 2 // C++
612 // -10 = -2, - 8 # Python
7
812 / 10 = 1, 2 // Both
912 // 10 = 1, 2
10
11-12 / -10 = 1, - 2 // Both
12 = 2, + 8
13
14C++:
151. m%(-n) == m%n
162. -m%n == -(m%n)
173. (m/n)*n + m%n == m
18
19Python:
201. m%(-n) == -8 == -(-m%n)
212. (m//n)*n + m%n == m
22#include <iostream>
23
24int main()
25{
26 int dividend, divisor, quotient, remainder, check;
27 std::cout << "Enter Dividend: "; // -27
28 std::cin >> dividend;
29 std::cout << "Enter Divisor: "; // 4
30 std::cin >> divisor;
31
32 quotient = dividend / divisor;
33 std::cout << "Quotient = " << quotient << std::endl; // -6
34 remainder = dividend % divisor;
35 std::cout << "Remainder = " << remainder << std::endl; // -3
36
37 check = quotient * divisor + remainder;
38 std::cout << "Check = " << check << std::endl; // -27
39 return 0;
40}
41print("Enter Dividend: ") # -27
42dividend = int(input())
43print("Enter Divisor: ") # 4
44divisor = int(input())
45quotient = dividend // divisor;
46print("Quotient = " + str(quotient)) # -7
47modulus = dividend % divisor;
48print("Modulus = " + str(modulus)) # 1
49check = quotient * divisor + modulus; # -27
50print("Check = " + str(check))
51
Note that, for the given inputs of different signs (-27 and 4), both the quotient and remainder/modulus are different between the languages but also that the restored check
value is correct in both cases.
QUESTION
Build Warning : Mapping new ns to old ns
Asked 2022-Jan-28 at 12:53So, I'm using Flutter and on running the App, I receive errors like these in the debug console:
1Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
2
I did flutter clean
, but no effect.
I tried the answer here: How to change build tools version in Android Studio
But, when I look for build.gradle file, I have two files one in /android and another in /android/app. But both of these do not have any configuration to change buildToolsVersion
.
I did sdkmanager --list_installed
and I hae two build-tools versions:
1Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
2 build-tools;29.0.2 | 29.0.2 | Android SDK Build-Tools 29.0.2 | build-tools/29.0.2
3 build-tools;30.0.2 | 30.0.2 | Android SDK Build-Tools 30.0.2 | build-tools/30.0.2
4
What should I do to fix this Warning ?
Also, I am not using Android Studio. I used this guide to install Flutter without Android Studio: How to Install and Configure Flutter Without Android Studio
ANSWER
Answered 2021-Jul-31 at 19:43It not happen becuase of you have two build-tools version installed. It happens because of caches so on android studio just invalidating caches and restarting will fix this.
QUESTION
Where to put formatMsgNoLookups in the Log4j XML configuration file
Asked 2022-Jan-02 at 16:01I configure my Log4j with an XML file. Where should I add the formatMsgNoLookups=true?
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Upload files compare config -->
3<configuration status="OFF">
4 <appenders>
5 <Console name="Console" target="SYSTEM_OUT">
6 <PatternLayout pattern="%d{HH:mm:ss} %p - %msg%n"/>
7 </Console>
8
9 <!-- http://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender -->
10 <RollingFile name="File" fileName="logs/MyLogFile.log"
11 filePattern="logs/MyLogFile-%d{yyyy-MM-dd}.log"
12 ignoreExceptions="false">
13 <PatternLayout>
14 <Pattern>%d %p %c{1.} %m%n</Pattern>
15 </PatternLayout>
16 </RollingFile>
17 </appenders>
18 <Loggers>
19 <Root level="INFO">
20 <AppenderRef ref="File"/>
21 <AppenderRef ref="Console"/>
22 </Root>
23 </Loggers>
24</configuration>
25
ANSWER
Answered 2022-Jan-02 at 14:42As DuncG commented, the option to disable lookups for Log4j is not a configuration option but a system property
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Upload files compare config -->
3<configuration status="OFF">
4 <appenders>
5 <Console name="Console" target="SYSTEM_OUT">
6 <PatternLayout pattern="%d{HH:mm:ss} %p - %msg%n"/>
7 </Console>
8
9 <!-- http://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender -->
10 <RollingFile name="File" fileName="logs/MyLogFile.log"
11 filePattern="logs/MyLogFile-%d{yyyy-MM-dd}.log"
12 ignoreExceptions="false">
13 <PatternLayout>
14 <Pattern>%d %p %c{1.} %m%n</Pattern>
15 </PatternLayout>
16 </RollingFile>
17 </appenders>
18 <Loggers>
19 <Root level="INFO">
20 <AppenderRef ref="File"/>
21 <AppenderRef ref="Console"/>
22 </Root>
23 </Loggers>
24</configuration>
25log4j2.formatMsgNoLookups
26
Depending on your environment (Spring, stand-alone executable, Tomcat web application,…) the way system properties are set may vary. The simplest possibility for starting a Java process from a JAR file would be to add
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Upload files compare config -->
3<configuration status="OFF">
4 <appenders>
5 <Console name="Console" target="SYSTEM_OUT">
6 <PatternLayout pattern="%d{HH:mm:ss} %p - %msg%n"/>
7 </Console>
8
9 <!-- http://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender -->
10 <RollingFile name="File" fileName="logs/MyLogFile.log"
11 filePattern="logs/MyLogFile-%d{yyyy-MM-dd}.log"
12 ignoreExceptions="false">
13 <PatternLayout>
14 <Pattern>%d %p %c{1.} %m%n</Pattern>
15 </PatternLayout>
16 </RollingFile>
17 </appenders>
18 <Loggers>
19 <Root level="INFO">
20 <AppenderRef ref="File"/>
21 <AppenderRef ref="Console"/>
22 </Root>
23 </Loggers>
24</configuration>
25log4j2.formatMsgNoLookups
26-Dlog4j2.formatMsgNoLookups=true
27
to your command line:
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Upload files compare config -->
3<configuration status="OFF">
4 <appenders>
5 <Console name="Console" target="SYSTEM_OUT">
6 <PatternLayout pattern="%d{HH:mm:ss} %p - %msg%n"/>
7 </Console>
8
9 <!-- http://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender -->
10 <RollingFile name="File" fileName="logs/MyLogFile.log"
11 filePattern="logs/MyLogFile-%d{yyyy-MM-dd}.log"
12 ignoreExceptions="false">
13 <PatternLayout>
14 <Pattern>%d %p %c{1.} %m%n</Pattern>
15 </PatternLayout>
16 </RollingFile>
17 </appenders>
18 <Loggers>
19 <Root level="INFO">
20 <AppenderRef ref="File"/>
21 <AppenderRef ref="Console"/>
22 </Root>
23 </Loggers>
24</configuration>
25log4j2.formatMsgNoLookups
26-Dlog4j2.formatMsgNoLookups=true
27java -Dlog4j2.formatMsgNoLookups=true -jar myapp.jar
28
QUESTION
What is "<[_]>" in Rust?
Asked 2021-Dec-24 at 07:35In the vec!
macro implementation there is this rule:
1($($x:expr),+ $(,)?) => (
2 $crate::__rust_force_expr!(<[_]>::into_vec(box [$($x),+]))
3);
4
What exactly is that <[_]>
in it?
ANSWER
Answered 2021-Dec-18 at 21:03Let's go step by step to see how <[_]>::into_vec(box [$($x),+])
produces a Vec
:
[$($x),+]
expands to an array of input elements:[1, 2, 3]
box ...
puts that into aBox
.box
expressions are nightly-only syntax sugar forBox::new
:box 5
is syntax sugar forBox::new(5)
(actually it's the other way around: internallyBox::new
usesbox
, which is implemented in the compiler)<[_]>::into_vec(...)
calls theto_vec
method on a slice containing elements that have an inferred type ([_]
). Wrapping the[_]
in angled brackets is needed for syntactic reasons to call an method on a slice type. Andinto_vec
is a function that takes a boxed slice and produces aVec
:
1($($x:expr),+ $(,)?) => (
2 $crate::__rust_force_expr!(<[_]>::into_vec(box [$($x),+]))
3);
4pub fn into_vec<A: Allocator>(self: Box<Self, A>) -> Vec<T, A> {
5 // ...
6}
7
This could be done in many simpler ways, but this code was fine-tuned to improve the performance of vec!
. For instance, since the size of the Vec
can be known in an advance, into_vec
doesn't cause the Vec
to be reallocated during its construction.
Community Discussions contain sources that include Stack Exchange Network