How do I migrate “yarn run-script build” task from frontend-maven-plugin to gradle?

How do I migrate “yarn run-script build” task from frontend-maven-plugin to gradle?



I use gradle-node-plugin instead of frontend-maven-plugin.

"yarn run-script build" task in maven is written such as following


<execution>
<id>yarn run-script build</id>
<goals>
<goal>yarn</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<arguments>build</arguments>
<environmentVariables>
<buildDir>$project.build.directory/classes/static</buildDir>
</environmentVariables>
</configuration>
</execution>



In gradle, I wrote yarnScriptBuild task


task yarnScriptBuild(type: YarnTask, dependsOn: yarnTest)
group 'Node'
args = ['run', 'build']



If I did "./gradlew yarnScriptBuild" command,

I got the error "Output path MUST not be project root directory!"

Then I inserted outputs.dir = ("$buildDir/classes") to yarnScriptBuild,but it didn't work.

(I found the page "$buildDir means root directory/build" few days ago)

I got another error "No such property: dir for class: org.gradle.api.internal.tasks.DefaultTaskOutputs"


outputs.dir = ("$buildDir/classes")



Does this mean that "dir" property isn't exist?

How should I do? What is missing?



If information lacks, please let me know.

Thank you.




1 Answer
1



Try configuring the yarnWorkDir and nodeWorkDir in NodeExtension :


yarnWorkDir


nodeWorkDir


NodeExtension


NodeExtension node = project.extensions.getByType(NodeExtension.class)
node.with
nodeModulesDir = $pathToDirWithNodeModulesDir
yarnWorkDir = $pathToYarnJs



also, you might want to fix your outputs path to this:


outputs



outputs.dir = project.file("$buildDir/classes")


outputs.dir = project.file("$buildDir/classes")



or this:



output.dir "$buildDir/classes"


output.dir "$buildDir/classes"






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ

How do I collapse sections of code in Visual Studio Code for Windows?