InteliJ maven vs normal maven

Multi tool use
Multi tool use


InteliJ maven vs normal maven



I would like to add my own commands to delete a specific folder in the mvn repoistory whenever I run a maven command.



For using maven through the command prompt, this is quite easy since we just update apache-maven-3.5.3binmvn.cmd .


apache-maven-3.5.3binmvn.cmd



However, I noticed that when we run mvn from inteliJ Maven projects Tool Window, the command run is the following:


Maven projects Tool Window


C:mbakOrgOracleJDKjdk1.8.0_60binjava -Dmaven.multiModuleProjectDirectory=
C:mbakOrg_CODEMNE_ARCHIT_GIT_REPOSsg-template-store -Dmaven.home=C:mbakOrgbuildapache-maven-3.5.3 -
Dclassworlds.conf=C:mbakOrgbuildapache-maven-3.5.3binm2.conf "-javaagent:C:mbakOrgdevelJetBrainsIntelliJ IDEA
2017.1.3libidea_rt.jar=42633:C:mbakOrgdevelJetBrainsIntelliJ IDEA 2017.1.3bin" -Dfile.encoding=UTF-8 -classpath
C:mbakOrgbuildapache-maven-3.5.3bootplexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2017.1.3 clean install



So how will I add a command that will run every time?
Since maven in InteliJis using a custom way to run maven.


InteliJ



My problem is basically that the mvn -U command does not properly pull the newest code all the time. Additionally, we are all using a snapshot of a parent project that is being updated quite often to fix issues.





Why do you need to delete a directory in local cache? You simply should use mvn package instead of mvn install?
– khmarbaise
Jul 2 at 14:09


mvn package


mvn install





@khmarbaise My problem is basically that the mvn -U command does not properly pull the newest code all the time. Additionally, we are all using a snapshot of a parent project that is being updated quite often to fix issues.
– Menelaos Bakopoulos
Jul 2 at 14:31





By newest code all the time you mean a project which has been deployed beforehand with the appropriate code ...Are you using dependencies which depend on this code and are you using SNAPSHOT dependencies ? Can you show examples of the pom file you are using and how you are deploying the code to a repository manager ?
– khmarbaise
Jul 2 at 18:40


newest code all the time





I mean that we have a parent Pom and dependency that is actually hosted as a deployed snapshot on a nexus repository. Another team has lately been making quite a few changes and they unfortunately it is the beginning so they didn’t have a deployed release. Hence, the since it is a snapshot stuff changes and something that was breaking may not break anymore ( as long as the -U flag has pulled the newest stuff). So it happens we say “it don’t work”. They say “use -U”, works for us. And if we delete the cache, it actually does work :(
– Menelaos Bakopoulos
Jul 2 at 22:52





Without knowing the details and the poms and how exactly the other people do the deploy via mvn deploy and furthermore how you exactly have defined the dependencies in your pom I can't say if there is a problem to solve or not..furthermore mvn -U clean package should work without cleaning the local cache...
– khmarbaise
Jul 3 at 7:07


mvn deploy


mvn -U clean package




1 Answer
1



I would strongly discourage modification of mvn.cmd. Even if you figure out how to do it in command line, and in InteliJ, then think about moving to some kind of Continuous Integration framework, like Jenkins for example, which will use default mvn.cmd?

If there is no possibility to achieve what you want with existing Maven tools, I would recommend writing own Maven plugin, (see this tutorial), and put required functionality there. It will guarantee, that this particular piece of code will be executed in all the environments, and this is the way to make sure, that the command will be launched every time.


mvn.cmd


mvn.cmd





My problem is basically that the mvn -U command does not properly pull the newest code all the time. Additionally, we are all using a snapshot of a parent project that is being updated quite often to fix issues.
– Menelaos Bakopoulos
Jul 2 at 14:31







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.

i4w5tu U7PA6X4u,OD P0XhnibBGJQXWKreqh69HWwhCp,MFFK0s8Mr5itVLfWykYHn tipOy HUHhn 1s25N4ijLkzCljP9W3jYQG8KHU
vxFtmVcP nTAIGLYP5UiYixkLwySIvouvktqX,s3Nr8mn,D1eMt,e nVi9z2Q NudkHeEZNyen1J FkopUkjCvoVRHwQ8 O8,u3mw74uyN

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications