Gradle: Task not found in root project (+ weird tasks.json error) - json

I'm getting a Task 'run' not found in root project 'Project-Name' whenever I try to do gradle run.
It was built successfully. I did see however, in my tasks.json file it does contain the run task.
In the documentation visual studio has this:
"version": "2.0.0",
"tasks": [
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"problemMatcher": ["$tsc"],
"group": {
"kind": "build",
"isDefault": true
}
I have something similar, but there is a yellow line under:
"group": {
"kind": "build",
"isDefault": true
}
With the error showing up as
"Incorrect type. Expected "string".
Documentation shows this is correct - could this be the issue on why it can't locate the Run task or is it something else?
Thank you

Related

invalid composer.json metadata packagist

When I push new tag to my package to update my composer plugin it returns this error:
Update of failed, invalid composer.json metadata
[Composer\Repository\InvalidRepositoryException] Some branches
contained invalid data and were discarded, it is advised to review the
log and fix any issues present in branches
Here is my composer.json file:
{
"name": "package/name",
"description": "....",
"keywords": [
"...",
"...",
"..."
],
"homepage": "https://github.com/username/package-name",
"type": "composer-plugin",
"require": {
"php": "^7.4|^8.0",
"illuminate/support": "^7.0|^8.0|^9.0"
},
"require-dev": {
"composer/composer": "^2.0"
},
"license": "MIT",
"autoload": {
"psr-4": {
"Package\\Name\\": "src/"
}
},
"authors": [
{
"name": "My name",
"email": "my#email.com"
}
],
"minimum-stability": "dev"
}
And when I run composer validate I get ./composer.json is valid.
As you can see there is no domain name mention whatsoever but error is returning my domain name as invalid which says: must be an http/https URL
Any idea?
You need to read the error message in full and with peace of mind (unfortunately you were hiding it from the question by encoding it as image/png).
Don't look into one revision, instead search the history for it:
$ git log -p -S 'funding' main composer.json
It should get you started to learn about the revisions that are related to "funding" in composer.json within the main branch.

gfortran linking and compiling subprograms in Visual Studio Code

I would like to compile and run fortran subprograms using Visual Studio code.
When I try debugging the code, I get an error stating that the "prelaunch task 'gfortran' terminated with exit code 1", with the following console message:
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain#16'
collect2.exe: error: ld returned 1 exit status
The terminal process "C:\MinGW\bin\gfortran.exe '-g', 'D:\......\params.f95', '-o', 'D:\.......\params.exe'" terminated with exit code: 1.
When I click 'show errors' it says that 'no problems have been detected in the worskpace so far'
My json file configurations for the folder are as follows:
Launch.json
{
"version": "2.0.0",
"configurations": [
{
"name": "Fortran Launch (GDB)",
"type": "cppdbg",
"request": "launch",
"targetArchitecture": "x86",
"program": "${workspaceRoot}\\${fileBasenameNoExtension}.exe",
"miDebuggerPath": "gdb.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"externalConsole": true,
"preLaunchTask": "gfortran"
}
]
}
tasks.json
{
"version": "2.0.0",
"command": "gfortran",
"args": [
"-g",
"${file}",
"-o",
"${workspaceRoot}\\${fileBasenameNoExtension}.exe"
]
}
I tried many of the fixes found from the web, such as changing the default setting to save file before run, reinstalling gfortran etc., but to no avail. When I try compiling from the command prompt, I do not have any errors, but when I use the flag -g, I have the same error about 'undefined reference to WinMain#16'. Also, I have no problem using the settings to run a single fortran code (without subprograms).
I have a Windows-32 architecture, and I have used MinGW to install gfortran. I have set the System Environment Variable 'Path' to include this folder.
I hope the problem is clear, please help me with this.

VSCode Linux tasks.json MQL4 Compilation

I am switching to VSCode from MetaEditor to develop for MetaTrader4.
I'm using MetaTrader4 and MetaEditor in Linux via Wine.
(and MetaEditor runs quite terribly in Wine)
I would like to create a task to compile the code, and hopefully return the same error log to VSCode to further debug the code as if I was using MetaEditor.
I've used this post to figure out what CLI command has been used to compile MQL4:
Compiling MQL4 via command line through wine metaeditor.exe
/usr/bin/wine /path/to/MT4/metaeditor.exe /compile:"Z:\path\to\MT4\MQL4\Experts\Foo\Bar_EA.mq4" /include:"Z:\path\to\MT4\MQL4" /log
My issue is that I don't understand and cannot find any resource that explains what the "commands" inside the tasks.json file does or list of available variables. Like "/include:" or "presentation":, ${file}, etc.
So I took some guesses and I pieced it together to look something like this so far:
{
"version": "2.0.0",
"tasks": [
{
"label": "MQL4 Compile",
"type": "shell",
"command": "/usr/bin/wine /.wine/drive_c/Program Files (x86)/FXChoice MetaTrader 4/metaeditor.exe",
"args": [
"/compile:${file}"
]
}
]
}
Its probably not quite right.
I appreciate your help, thank you
{
"version": "2.0.0",
"tasks":
[
{
"label": "MQL4-Compile",
"group":
{
"kind" : "build",
"isDefault" : true
},
"presentation":
{
"echo" : true,
"reveal": "always",
"focus" : true,
"panel" : "shared"
},
"promptOnClose" : true,
"type" : "process",
"osx" :
{
"command" : "wine",
"args" :
[
"/Users/SVG/.wine/drive_c/Program Files/MetaTrader/metaeditor.exe",
"/compile:${fileBasename}",
"/log:${fileBasenameNoExtension}.log",
]
},
"windows" :
{
"command" : "C:\\Program Files (x86)\\MetaTrader\\metaeditor.exe",
"args" :
[
"/compile:${fileBasename}",
"/log:${fileBasenameNoExtension}.log",
]
},
}
]
}

How to fix "/bin/bash: [command] command not found" after setting up tasks.json and c_cpp_properties.json for C++ on Windows 10 VS Code?

I have configured my task.json and c_cpp_properties.json so that I may compile my main.cpp program. In order to proceed, I must press
Ctrl + Shift + B
As soon as I do a terminal pops up and alters me of an error:
Executing task in folder C++: C:\MinGW\bin\g++.exe -g main.cpp -o c:\Users\Me\Desktop\C++\.vscode\tasks.exe <
/bin/bash: C:MinGWbing++.exe: command not found
The terminal process terminated with exit code: 127
Terminal will be reused by tasks, press any key to close it.
I don't why this is happening since I've already checked that MinGW is installed in my computer with the correct PATH. To ensure that I do I typed the following in the terminal:
g++ --version
g++ (MinGW.org GCC-8.2.0-3) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
I also checked the path according to this figure
The only closest problem related to mine is in this Github link. I've also already tried changing the file directory shown in the code below using this thread but I still encounter this error.
Here are my JSON files which are inside my .vscode file:
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "C:\\MinGW\\bin\\g++.exe",
"args": [
"-g",
"main.cpp",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
]
}
c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.17134.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"${workspaceRoot}",
"C:\\MinGW\\lib\\gcc\\mingw32\\8.2.0\\include\\c++"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 4
}
I should expect to see a ".exe" after compiling but I can't due to the error.
After spending two days messing around with this I've finally able to correct setup C++ on VS Code and resolved the error.
According to the png image from above, I've included "C:\MinGW\bin" within the user variable "Path" under the dialogue box "User variables for Me". After a simple restart on my computer, I was able to build my project (Shift + Ctrl + B) with no problems.

Getting extension from private repo with composer

I have to create a private yii2 extension on BitBucket, and install it in my projects with composer.
The SSH is set up correctly as far as I can understand, it was not at first - and I got an error "repo not found or you do not have permission" (or something of the kind).
The composer finds the composer.json, I removed it to test and I got an error message that "valid composer.json not found".
Now when i run composer update in my Git Bash it just prints "Nothing to install or update" and nothing appears in my vendor/ folder.
I have no errors to go on here, any ideas are mostly welcome!
I've set up the repo and added the following files:
composer.json
{
"name": "ext. name",
"type": "yii2-extension",
"description": "My desc",
"authors": [
{
"name": "Jorgen",
"email": "jorgen#domain.com",
"homepage": "http://www.domain.com"
}
],
"minimum-stability": "stable",
"support": {
"source": "bitbucket.org/companyname/yii2-extensionname"
},
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "2.0.*"
},
"autoload": {
"psr-4": {
"companyname\\extensionname\\": ""
}
}
}
.gitignore
vendor/**
models/Test.php
<?php
namespace companyname\extensionname\models;
class Test
{
}
And I've added the following to my Yii2 project composer.json:
"repositories": [
{
"type": "vcs",
"url": "ssh://git#bitbucket.org/companyname/yii2-extensionname",
}
],
Update
So I figured out that if I add my repo in this format it's found and downloaded, but the autoloader-psr4.php file is not updated with my autoloading.
"repositories": [
{
"type": "package",
"package": {
"name": "vendor/yii2-extension-name",
"version": "master",
"source": {
"type": "git",
"url": "git#bitbucket.org:vendor/yii2-extension-name",
"reference": "origin/master"
}
}
}
When I have
"repositories": [
{
"type": "git",
"url": "https://bitbucket.org/vendor/yii2-extension-name"
}
],
I get the following error:
Problem 1
- The requested package vendor/yii2-extension-name could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion for more details.
Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.
There is no typos, its found and downloaded when I use "package". But then the autoloader is not updated.I've also tried all sorts of variations with git#, https and ssh. It always works as a package, never as a git or vcs.
Edit: oh, and minimum-stability is set to dev while troubleshooting.
You must use the correct name:
{
"name": "vendor/yii2-extension-name",
"type": "yii2-extension",
That is usually your Bitbucket username followed by the name of your repository.
That will work with your repositories Composer setting:
"repositories": [
{
"type": "git",
"url": "https://bitbucket.org/vendor/yii2-extension-name"
}
],