关闭项目:File --》Close Project
打开项目: Open /Users/wangrui/Desktop/maven-jar
删除项目:可以在主界面,Open处打开,然后在文件操作界面进行删除
对于Java程序员来说,很多人应该都在使用Intellij Idea这款IDE了,确实非常智能和好用。但是对于开发sprint boot/cloud的应用的时候,只有专业版才有spring initializr可以方便的生成spring boot/cloud的工程,那么对于社区版的用户,有没有别的插件可以实现同样的功能? 那就是Spring Assitant了。Spring Assistant 提供了对spring boot/cloud 工程的支持,可以非常方便的生成spring boot/cloud的工程,同时支持在编写配置文件的时候进行提示。(最终区别就是:免费与非免费)
所以如果用的社区版就下载spring Assistant插件即可
中国服务开发基本都用maven,如果是安卓服务的开发可以用gradle。
Maven:https://www.cnblogs.com/yjmyzz/p/3495762.html
https://developer.aliyun.com/ask/133581?spm=a2c6h.13159736
点击软件左上角的ittellij idea 选择preferences 选择plugins 然后搜索插件名字即可
Window: https://www.cnblogs.com/ka-bu-qi-nuo/p/9182655.html
Mac: https://www.jianshu.com/p/b8c13ca3154a
更改方法如下:
(1)单击File | Project Structure菜单项,打开ProjectStructure对话框。
(2)在左侧列表框中,选择SDKs列表项,进入SDK配置页面。
(3)若中间的SDK列表框没有选项,则单击“+”号创建一个JDK列表项。
(4)选择JDK列表项,在SDK ’JDK’选项卡页面中,单击JDK home path项目的浏览按钮,定位JDK安装路径并保存。
https://blog.csdn.net/Smiledmdm/article/details/85951699
参考: https://blog.csdn.net/shiyibodec/article/details/52982681
右键左上角竖排项目名,选择compact middle package即可
https://blog.csdn.net/qq598535550/article/details/51703190
参考:https://blog.csdn.net/konzy/article/details/81626629
https://blog.csdn.net/chenshun123/article/details/51285890
修改完版本之后,将其中Other Seeting 中搜索出的Maven-》User seeting fiels 修改为当前我们所使用的maven版本conf中所提供的seeting.xml【当然也可以自己配】,然后最好,修改1.下载源:阿里云,2.默认jdk版本,【暂时不知道,只知道是配置此文件的profile标签】。3。jar镜像存储路径 <localRepository>
Vm Options: -Xms550m -Xmx1250m -XX:PermSize==550m -XX:MaxPermSize=1250m
如果第二步没有配置默认jdk:那么需要每次创建新的项目时在pom.xml中添加jdk配置:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
Setting.xml中全局配置:
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
Settings.xml配置文件详解:https://www.cnblogs.com/soupk/p/9303611.html
自我学习后总结:
平时我们只需要去使用idea右边菜单栏自带的maven,的Lifecycle中的各命令就可以【强烈建议使用Lifecycle】
Lifecycle:【缺少插件自动下载】【注意:使用Lifecycle中的命令无需在pom.xml文件中添加多余的插件,否则会因为重复寻找插件而报错】,Plugin:不会自动下载缺少的插件,需要在pom.xml中进行配置。【不建议使用】
【其他具体配置请自行百度,下面配置,设置了源仓库:阿里云,默认jdk 1.8,】
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
| This is the configuration file for Maven. It can be specified at two levels:
|
| 1. User Level. This settings.xml file provides configuration for a single user,
| and is normally provided in ${user.home}/.m2/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
|
| -s /path/to/user/settings.xml
|
| 2. Global Level. This settings.xml file provides configuration for all Maven
| users on a machine (assuming they're all using the same Maven
| installation). It's normally provided in
| ${maven.conf}/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
|
| -gs /path/to/global/settings.xml
|
| The sections in this sample file are intended to give you a running start at
| getting the most out of your Maven installation. Where appropriate, the default
| values (values used when the setting is not specified) are provided.
|
|-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<localRepository>/Users/wangrui/Desktop/maven-jar/repository</localRepository>
<!-- interactiveMode
| This will determine whether maven prompts you when it needs input. If set to false,
| maven will use a sensible default value, perhaps based on some other setting, for
| the parameter in question.
|
| Default: true
<interactiveMode>true</interactiveMode>
-->
<!-- offline
| Determines whether maven should attempt to connect to the network when executing a build.
| This will have an effect on artifact downloads, artifact deployment, and others.
|
| Default: false
<offline>false</offline>
-->
<!-- pluginGroups
| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
|-->
<pluginGroups>
<!-- pluginGroup
| Specifies a further group identifier to use for plugin lookup.
<pluginGroup>com.your.plugins</pluginGroup>
-->
</pluginGroups>
<!-- proxies
| This is a list of proxies which can be used on this machine to connect to the network.
| Unless otherwise specified (by system property or command-line switch), the first proxy
| specification in this list marked as active will be used.
|-->
<proxies>
<!-- proxy
| Specification for one proxy, to be used in connecting to the network.
|
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
-->
</proxies>
<!-- servers
| This is a list of authentication profiles, keyed by the server-id used within the system.
| Authentication profiles can be used whenever maven must make a connection to a remote server.
|-->
<servers>
<!-- server
| Specifies the authentication information to use when connecting to a particular server, identified by
| a unique name within the system (referred to by the 'id' attribute below).
|
| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
| used together.
|
<server>
<id>deploymentRepo</id>
<username>repouser</username>
<password>repopwd</password>
</server>
-->
<!-- Another sample, using keys to authenticate.
<server>
<id>siteServer</id>
<privateKey>/path/to/private/key</privateKey>
<passphrase>optional; leave empty if not used.</passphrase>
</server>
-->
</servers>
<!-- mirrors
| This is a list of mirrors to be used in downloading artifacts from remote repositories.
|
| It works like this: a POM may declare a repository to use in resolving certain artifacts.
| However, this repository may have problems with heavy traffic at times, so people have mirrored
| it to several places.
|
| That repository definition will have a unique id, so we can create a mirror reference for that
| repository, to be used as an alternate download site. The mirror site will be the preferred
| server for that repository.
|-->
<mirrors>
<!-- 阿里云仓库 -->
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<!-- 中央仓库1 -->
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
<!-- 中央仓库2 -->
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
</mirrors>
<!-- profiles
| This is a list of profiles which can be activated in a variety of ways, and which can modify
| the build process. Profiles provided in the settings.xml are intended to provide local machine-
| specific paths and repository locations which allow the build to work in the local environment.
|
| For example, if you have an integration testing plugin - like cactus - that needs to know where
| your Tomcat instance is installed, you can provide a variable here such that the variable is
| dereferenced during the build process to configure the cactus plugin.
|
| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
| section of this document (settings.xml) - will be discussed later. Another way essentially
| relies on the detection of a system property, either matching a particular value for the property,
| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
| Finally, the list of active profiles can be specified directly from the command line.
|
| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
| repositories, plugin repositories, and free-form properties to be used as configuration
| variables for plugins in the POM.
|
|-->
<profiles>
<!-- profile
| Specifies a set of introductions to the build process, to be activated using one or more of the
| mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
| or the command line, profiles have to have an ID that is unique.
|
| An encouraged best practice for profile identification is to use a consistent naming convention
| for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
| This will make it more intuitive to understand what the set of introduced profiles is attempting
| to accomplish, particularly when you only have a list of profile id's for debug.
|
| This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
<profile>
<id>jdk-1.4</id>
<activation>
<jdk>1.4</jdk>
</activation>
<repositories>
<repository>
<id>jdk14</id>
<name>Repository for JDK 1.4 builds</name>
<url>http://www.myhost.com/maven/jdk14</url>
<layout>default</layout>
<snapshotPolicy>always</snapshotPolicy>
</repository>
</repositories>
</profile>
-->
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
<!--
| Here is another profile, activated by the system property 'target-env' with a value of 'dev',
| which provides a specific path to the Tomcat instance. To use this, your plugin configuration
| might hypothetically look like:
|
| ...
| <plugin>
| <groupId>org.myco.myplugins</groupId>
| <artifactId>myplugin</artifactId>
|
| <configuration>
| <tomcatLocation>${tomcatPath}</tomcatLocation>
| </configuration>
| </plugin>
| ...
|
| NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
| anything, you could just leave off the <value/> inside the activation-property.
|
<profile>
<id>env-dev</id>
<activation>
<property>
<name>target-env</name>
<value>dev</value>
</property>
</activation>
<properties>
<tomcatPath>/path/to/tomcat/instance</tomcatPath>
</properties>
</profile>
-->
</profiles>
<!-- activeProfiles
| List of profiles that are active for all builds.
|
<activeProfiles>
<activeProfile>alwaysActiveProfile</activeProfile>
<activeProfile>anotherAlwaysActiveProfile</activeProfile>
</activeProfiles>
-->
</settings>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable>/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/javac</executable>
</configuration>
</plugin>
</plugins>
</build>
然后在我们自己下载的apache-mave-3.6.1文件夹中的conf配置好settings.xml并在其中指定repository存储的路径
<localRepository>/Users/xxxx/Desktop/maven-jar/repository</localRepository>
也就是上面的settings.xml配置文件
然后去配置mvn的环境变量,使其在命令行可以正常使用
Mvn命令不生效原因
配置maven环境变量时,path系统变量中配置了 ;%MAVEN_HOME%\bin,但是在命令窗口执行mvn -version没有生效,解决办法就是在path环境变量中直接配置maven的bin目录的位置,如:在path环境变量添加;D:\apache-maven-3.5.4\bin;问题得到解决!!!
https://blog.csdn.net/qq_27093465/article/details/52912444
注意:这里最好只设置main里的java与test里的java,否则package 引入包的时候,就需要默认从你配置的路径引,相当于一个默认的相对路径.
栗子:设置src: package main.java.com.xxx.yyy
而设置java: package com.xxx.yyy
https://blog.csdn.net/fenqing1213/article/details/83316265
关闭项目,以及idea,找到该idea的根目录,删除.idea文件,然后在idea的初始界面,重新打开该项目,即可
我是用的是idea2019版本和3.6.2版本的maven
具体报错信息可以在Help->Show Log In Finder中的日志文件中查看
我解决的方法是:
1.首先如果环境变量有问题的话:环境变量配置有问题,我配置的绝对路径,然后改为在bash_profile文件中定义一个环境变量 export M2_HOME=”maven绝对路径”,然后再为PATH赋值export PATH = M2_HOME/bin:$PATH即可。然后我的程序就好了,点击idea右面maven然后点击刷新图标就可以正常导入jar包了【注意:配置绝对路径时,要加上双引号,以及=两边不要有多余的缩进】
Idea 行注释设置(不显示在行首):
进入 Settings -> Code Style -> Java ,在右边选择 “Code Generation” Tab,然后找到 Comment Code 那块,把
Line comment at first column
Block comment at first column
去掉前面两个的复选框
https://www.cnblogs.com/pcheng/p/10121683.html 记得在两种注释上加上@description, 【简介的意思】
直接在file,prefercens的plugin,里去安装即可。