Netbeans Project with git and Composer repository

Asked

Viewed 210 times

9

I am developing a PHP project that requires two libraries separately. I am required to use NETBEANS.

To develop the three separately but at the same time and because the main project "MAIN PROJECT" needs the other two, I idealized:

  1. All projects with Composer...as usual

  2. All projects with git repositories... as usual

  3. By making changes to the two complementary projects I intend to update with the main project right after each clear commit.

To do it I thought it would be simple to put in such MAIN PROJECT the following:

"repositories": [ 
{   
   "packagist": false 
}, {    
 "type": "vcs",
 "url": "/localhost/htdocs/projecto1/" 
},{    
  "type": "vcs",
  "url": "/localhost/htdocs/projecto2/" 
}],

However, being local, I can’t get you to update directly from the git repository of each NETBEANS-created sub-project. I wanted to avoid putting the projects online until they are more developed. I have at the root of each project their file composer.json and of course the directory .git repository.

After hitting my head, I decided to ask if anyone has ever been through a similar situation and enlighten me on this subject... I have a lot of experience with Poser but I really don’t understand why it doesn’t work.

UPDATING: with you as artifact placing the repositories in zip’s but it’s far from what I intended. It forces me to zip, with the file composer.json at the root of the zip package... example:

 (...)
 "repositories": [
        {
            "packagist": false
        }, {
            "type": "artifact",
            "url": "/artifacts/"
        }],
 (...)

this excerpt is placed in the composer.json of projecto MAIN. I turn around but I can’t do it the way I find most interesting and productive from each repository GIT local for each project on which the main project depends.

Hasn’t anyone been through this yet?

  • You have to commit to update data on git. One idea would be to have all three projectiles in a single repository in the git.

  • @I changed it if I read the question well, you will see that in point 3 I mentioned it. I update with commit... But I can’t get to it. As for the only repository as you suggest?

  • A repository with only the three projectiles.

1 answer

4


I have been walking and as I mentioned in the question to develop three projects, where one I named the MAIN project depends on two other bases/components. As the development is simultaneously updating the code in the main draft on changes in the two complementary projects is important, so I was looking for a practical solution within the publisher that was imposed on me for the project NETBEANS.

How do I use the Composer for package management and the Git as a repository there would have to be a way to commit to each of the base projects and with Composer in the MAIN project to reference their "local" and developing repositories in order to update with the changes made.

My first solution was with the ZIP package approach as presented in the question but it does force you to zip and put the zip in a local repository folder. But if I perform commits it had to be possible to update the MAIN project from the respective repositories.

In the composer.jon of the basic projects I maintain the configurations, but in the MAIN project novelty happens by altering:

(...)
 "repositories": [
        {
            "packagist": false
        }, {
            "type": "artifact",
            "url": "/artifacts/"
        }],
(...)

for:

(...)
"repositories": [
        {
            "packagist": false
        }{
            "type": "package",
            "package": {
                "name": "projecto1",
                "version": "dev-master",
                "source": {
                    "url": "/localhost/htdocs/projecto1",
                    "type": "git",
                    "reference": "origin/master"
                }
            }
        },{
            "type": "package",
            "package": {
                "name": "projecto2",
                "version": "dev-master",
                "source": {
                    "url": "/localhost/htdocs/projecto2",
                    "type": "git",
                    "reference": "origin/master"
                }
            }
        }],
(...)

This way it is possible to perform the commits in both projects and in the MAIN project with only one Composer UPDATE updating my code for the latest versions in development. When it comes to a "NETBEANS" editor it’s just simple clicks, et voila. Note that to achieve this solution it is necessary to have git installed for command line support that NETBEANS performs!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.