PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, January 21, 2022

[FIXED] intellij: how to deploy to two folders?

 January 21, 2022     composer-php, deployment, intellij-idea, php     No comments   

Issue

The general question is: how to work with many different git repos at the same time in one intellij project. Where the git repos need to be inside the main application (that is one git repo too). I cannot use symlinks because I cannot commit those

I have 2 git repos

one is for the main app, the other one is for a library I am using in several projects.

Here is how it goes: I have the main app. Via composer I add my library / package to the application.

The problem:

folder structure:

to develop

IdeaProjects/myappA

note: there is are as well IdeaProjects myappB etc

IdeaProjects/mylib

in myappA there is

IdeaProjects/myappA/vendor/mylib

server deploy folder:

/var/www/www.myappA.com/

I do a lot of changes to the library, I have it open as another module when I work on myappA so I do code changes to mylib in that folder / module that actually contains the original source code of mylib. Now i don't want to composer install or update each time I do a tiny change. So what I do is I deploy via intellij the files from the library mylib each time on save directly into the composer install folder of my main application e.g. to IdeaProjects/myappA/vendor/mylib. Now the problem is, I need to deploy it as well to the server deployment folder. But there seems no way to deploy files to two folders out of the box with intellij.

What else can I do?

currently I manually use a short key to trigger an ant build that then copies the folder IdeaProjects/myappA/vendor/mylib to the server deployment directory.


Solution

There are multiple solutions depending on your setup:

solution inside intellij: just import mylib as a module inside your myapp project Go to File > Project Settings > Modules, click the + and choose import module import module

git native solution: Use submodules

Submodules allow you to keep a Git repository as a subdirectory of another Git repository. This lets you clone another repository into your project and keep your commits separate.

Note that there are some quirks when working with submodules, especially the way to keep the referenced submodules up-to-date

For completeness: if you were using gradle or maven instead of ant, you could use their respective projects views and use the + to add multiple build.gradle or pom.xml files, which would automatically import those projects as modules into intellij.



Answered By - Niels Doucet
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing