Create a java project with IDEA and run it
This IDEA version is 15
1.1 Create a project
1.2 Select project type
1.3 Fill in the project information
1.4 Fill in maven information
1.5 Fill in the project name
1.6 Waiting for maven to initialize the project
The project has just been created successfully, and there is no src directory when maven has not been initialized. After maven initializes the project, there is an additional src directory in the project, and the console prompts that maven successfully created the project.
1.7 Setting up the project structure
1.8 Set the project structure Facets
Note that mmall should be selected above, mmall is not selected by default
If the Output directory is shown like me, it means that the idea directory structure is wrong, and after setting tomcat to publish the project, it will report: Server is not connected. Deploy is not available.. You need to delete the .idea folder in the directory and re-import the project. I don’t know the reason. If you know the reason, please reply to me, and also ask how you can avoid deleting the .idea folder every time you create a project. Import, because I need to re-import every time I create a project now. The time node of this situation is that I imported an eclipse project with IDEA. I suspect that after importing the eclipse project, IDEA remembers the project result of eclipse, and every time I create it later IDEA projects all use the eclipse project structure, I wonder if the guess is correct. Of course, the report Server is not connected. Deploy is not available may also be caused by other reasons, you can refer to the following URL: https://stackoverflow.com/questions/20163910/tomcat-in-idea-war-exploded-server-is- not-connected-deploy-is-not-available
1.9 Delete the IDEA folder and re-import the project
If the situation described in 1.8 occurs, go to the corresponding folder of the project to delete the .idea folder. If the situation described in 1.8 does not appear, ignore this step. The following figure takes my computer as an example.
So far, the project has been successfully imported. Then configure tomcat to run the project.
1.10 Configure tomcat to run the project
So far, the project runs successfully.
2 Upload to github
2.1 Create a project on the github official website
2.2 Open a terminal window
2.3 Create README markdown file
$ touch README.md
2.4 Create a .gitignore file
The role of this file is that matches configured in this file will not be pushed to the git repository
$ touch .gitignore
After creating the .gitignore file, edit this file according to the following configuration items
*.class
#package files
*.war
*.ear
#kdiff3 ignore
target/
#eclipse ignore
.settings/
.project
.classpath
#idea
.idea/
/idea/
*.ipr
*.iml
*.iws
# temp file
*.log
*.cache
*.diff
*.patch
*.tmp
#system ignore
.DS_Store
Thumbs.db
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
2.5 Initialize this project for git version control
$ git init
After entering the above command, the following information will be prompted to indicate that the initialization is complete
Initialized empty Git repository in C:/Users/Alex/IdeaProjects/mmall/.git/
2.6 View file changes
Run the following command to see which project files have changed
$ git status
2.7 Add change file
$ git add .
2.8 Check the file changes again
$ git status
2.9 Submit to local repository
-am means add a comment after
$ git commit -am ‘first commit init project’
2.10 Linking to Remote Repositories
$ git remote add origin [email protected]:alexnest/mmall.git
The address can be copied from the github website
2.11 View branch
$ git branch
2.12 Submit to remote repository
git push -u origin master
After running the above command, an error is reported: the first submission needs to be pulled down from the remote. Execute the following command to pull the project on git
$ git pull
After completion, continue to execute the following command to submit to the remote warehouse
git push -u origin master
After executing the above command, continue to report an error. The error message is that the version of the local warehouse lags behind the remote warehouse. Because this is a new project, we can execute the following command to force the push to the remote warehouse.
$ git push -u -f origin master
Refresh the project page corresponding to github to see that the file has been submitted successfully.
2.13 Create version
Use the following commands to view the local branch and remote branch
View local branch $ git branch
View remote branch $ git branch -r
Create a new branch with the following command
$ git checkout -b v1.0 origin/master
View the current branch with the following command
$ git branch
Push the current branch to the remote with the following command
$ git push origin HEAD -u
So far, it has been pushed to the remote warehouse, refresh the git project page, you can see that the version number now has master and v1.0
https://blog.csdn.net/stevennest/article/details/77877074