IDEA构造maven项目

一,下载并解压阿帕奇项目到你的非系统盘符,创建一个my_maven_jar用来存放你的库

二,进入IDEA。

  • 进行如下操作,点击进去
    设置maven环境
  • 仔细看清楚路径与对勾,选择你文件所在目录
    image.png
  • 在我们配置好maven之后,点击File,New一个Project,我们选择maven,不再是Java,然后选中我们需要的,是.maven,看清楚。注意对勾。
    新建maven项目
  • 之后我们就填写自己的信息就可以,groupId为你的单位域名反写,下面的是项目名,默认1.0版本。
    image.png
  • 之后一路next,起自己的项目名。然后在新窗口打开。会出现如下界面,我们选择Enable那一项,点开右边的maven-project,不时点刷新,之后安静等待完成即可 。
    image.png
  • 在左边展开我们的项目,点击pom.xml,将其替换为如下代码。注意修改汉字标注好的部分

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>你的单位域名反写</groupId>
  <artifactId>你的项目名</artifactId>
  <version>1.0-SNAPSHOT</version>

  <name>你的项目名</name>
  <!-- FIXME change it to the project's website -->
  <url>http://www.example.com</url>

  <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>
    <kotlin.version>1.2.71</kotlin.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.kordamp.bootstrapfx</groupId>
      <artifactId>bootstrapfx-core</artifactId>
      <version>0.2.4</version>
    </dependency>
    <dependency>
      <groupId>org.fxmisc.richtext</groupId>
      <artifactId>richtextfx</artifactId>
      <version>0.9.1</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-stdlib-jdk8</artifactId>
      <version>${kotlin.version}</version>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-test</artifactId>
      <version>${kotlin.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>1.2.1</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>com.niit.FirstApp</mainClass>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-maven-plugin</artifactId>
        <version>${kotlin.version}</version>
        <executions>
          <execution>
            <id>compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
          <execution>
            <id>test-compile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>test-compile</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <jvmTarget>1.8</jvmTarget>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
#之后就构造好啦,该做什么做什么就可以了
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容