question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Do not delete generated package.json on mvn clean

See original GitHub issue

For various reasons, you run mvn clean package on your project instead of mvn package. This might be to update dependencies and remove old ones, to make sure code is re-generated or whatever other reason.

When doing mvn clean package, npm install is triggered even though the generated package.json has not been updated. Because the generated file is stored in target, it is removed by mvn clean and comparing the newly generated one to the existing one does not work.

This should be solved so mvn clean package does not need to run npm install.

Potential solutions:

  1. Move the generated package.json out of target so it is not removed. E.g. use the same webpack.config.js+webpack.generated.js pattern and name it /package.generated.json
  2. Store a hash of the generated package.json contents somewhere else for comparison purposes, e.g. main package.json

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:21 (20 by maintainers)

github_iconTop GitHub Comments

2reactions
caaladorcommented, Aug 5, 2019

As the contents for the folder ./target/frontend will be copied to ./node_modules/@vaadin/flow-deps we could do a compare on build. if we haven’t run npm install we won’t have the file available in node_modules as it is copied at that time, and if we have run it we can compare the created package.json against the node_modules version and only if they differ we execute npm install.

1reaction
Artur-commented, Aug 2, 2019

If you have two package.json files in the same folder then you might have some problems if both happen to install something into the same node_modules folder

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to clean node_modules folder of packages that are ...
Now I want to clean node_modules folder so that only modules listed in package.json stay there and the rest must go, something like...
Read more >
`mvn clean` should delete `node_modules` (1) - Explore · GitLab
json. The only solution I would see is on each build to copy over the whole web folder to target and then run...
Read more >
mvn clean install - a short guide to Maven
You are using the clean command, which will delete all previously compiled Java .class files and resources (like .properties) in your project.
Read more >
Maven packages in the Package Repository - GitLab Docs
To delete these older package versions, consider using the Packages API or the UI. Do not allow duplicate Maven packages. Version history.
Read more >
How to fix Maven build issue in Eclipse? Perform ...
Hi Lavanya – this seems like an issue with mvn command. Could you please try without MVN? i.e. clean install instead of mvn...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found