我已準備好部署項目,因此我需要創建可執行的jar以進行分發。閱讀網上現在我想clean and build
我的項目(ProjectMaven
)後,它是一個Maven
項目具有相關性(上Netbeans 8
)使用Netbeans清理並構建Maven項目 - 編譯失敗
我的項目對使用Maven
之後另一個項目,我已經創建了一個依賴閱讀this和this答案我做了我的pom.xml
文件是這樣的:
<?xml version="1.0" encoding="UTF-8"?>
<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>com.dwnz.project</groupId>
<artifactId>ProjectMaven</artifactId>
<name>DwnzProject</name>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<!-- nothing here -->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>view.MainFrame</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.googlecode.jcsv</groupId>
<artifactId>jcsv</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.24</version>
</dependency>
<dependency>
<groupId>com.dazito.retro.eventbus</groupId>
<artifactId>RetroEventBusMaven</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.6.Final</version>
</dependency>
</dependencies>
</project>
com.dazito.retro.eventbus
是我的其他Maven項目我創建了這個項目依賴。
這是Maven在我的項目上按Clean and Build
創建的輸出(ProjectMaven
)。
Compiling 48 source files to C:\Users\Dwnz\Documents\NetBeansProjects\ProjectMaven\target\classes
-------------------------------------------------------------
COMPILATION ERROR :
-------------------------------------------------------------
view/MainFrame.java:[9,32] error: cannot find symbol
view/MainFrame.java:[10,49] error: package com.dazito.retro.eventbus.buses.singletons does not exist
api/CallsToGUI.java:[7,32] error: cannot find symbol
view/toolbar/ToolBar.java:[9,32] error: cannot find symbol
view/toolbar/ToolBar.java:[10,49] error: package com.dazito.retro.eventbus.buses.singletons does not exist
view/menu/ExportTableDialog.java:[9,32] error: cannot find symbol
view/menu/ExportTableDialog.java:[10,49] error: package com.dazito.retro.eventbus.buses.singletons does not exist
view/toolbar/AskPasswordDialog.java:[9,32] error: cannot find symbol
view/toolbar/AskPasswordDialog.java:[10,49] error: package com.dazito.retro.eventbus.buses.singletons does not exist
view/menu/ImportTableDialog.java:[7,32] error: cannot find symbol
view/menu/ImportTableDialog.java:[8,49] error: package com.dazito.retro.eventbus.buses.singletons does not exist
view/MainFrame.java:[107,18] error: cannot find symbol
view/rightPanel/RightTable.java:[7,32] error: cannot find symbol
view/rightPanel/RightTable.java:[8,49] error: package com.dazito.retro.eventbus.buses.singletons does not exist
view/toolbar/ToolBar.java:[34,18] error: cannot find symbol
view/menu/ExportTableDialog.java:[46,18] error: cannot find symbol
view/toolbar/AskPasswordDialog.java:[52,12] error: cannot find symbol
view/menu/ImportTableDialog.java:[36,18] error: cannot find symbol
view/rightPanel/RightTable.java:[40,18] error: cannot find symbol
view/actionlisteners/ImportResultsActionListener.java:[10,32] error: cannot find symbol
view/actionlisteners/ImportResultsActionListener.java:[11,49] error: package com.dazito.retro.eventbus.buses.singletons does not exist
21 errors
-------------------------------------------------------------
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 4.311s
Finished at: Thu Oct 02 07:32:54 BST 2014
Final Memory: 30M/116M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project ProjectMaven: Compilation failure: Compilation failure:
view/MainFrame.java:[9,32] error: cannot find symbol
view/MainFrame.java:[10,49] error: package com.dazito.retro.eventbus.buses.singletons does not exist
api/CallsToGUI.java:[7,32] error: cannot find symbol
view/toolbar/ToolBar.java:[9,32] error: cannot find symbol
view/toolbar/ToolBar.java:[10,49] error: package com.dazito.retro.eventbus.buses.singletons does not exist
view/menu/ExportTableDialog.java:[9,32] error: cannot find symbol
view/menu/ExportTableDialog.java:[10,49] error: package com.dazito.retro.eventbus.buses.singletons does not exist
view/toolbar/AskPasswordDialog.java:[9,32] error: cannot find symbol
view/toolbar/AskPasswordDialog.java:[10,49] error: package com.dazito.retro.eventbus.buses.singletons does not exist
view/menu/ImportTableDialog.java:[7,32] error: cannot find symbol
view/menu/ImportTableDialog.java:[8,49] error: package com.dazito.retro.eventbus.buses.singletons does not exist
view/MainFrame.java:[107,18] error: cannot find symbol
view/rightPanel/RightTable.java:[7,32] error: cannot find symbol
view/rightPanel/RightTable.java:[8,49] error: package com.dazito.retro.eventbus.buses.singletons does not exist
view/toolbar/ToolBar.java:[34,18] error: cannot find symbol
view/menu/ExportTableDialog.java:[46,18] error: cannot find symbol
view/toolbar/AskPasswordDialog.java:[52,12] error: cannot find symbol
view/menu/ImportTableDialog.java:[36,18] error: cannot find symbol
view/rightPanel/RightTable.java:[40,18] error: cannot find symbol
view/actionlisteners/ImportResultsActionListener.java:[10,32] error: cannot find symbol
view/actionlisteners/ImportResultsActionListener.java:[11,49] error: package com.dazito.retro.eventbus.buses.singletons does not exist
-> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
我在做什麼錯?我怎樣才能解決這個問題,以便我可以清理和構建項目? 該項目沒有編譯錯誤,並在netbeans內按下運行按鈕時執行罰款。
貌似這個'com.dazito.retro.eventbus .buses.singletons' cass找不到。讓它不會拼寫錯誤,並且相關的jar文件在你的類路徑 – Jens 2014-10-02 06:44:59
中,你需要在build pom中定義它,這意味着你的項目必須由本地文件夾路徑定義或者在maven repo中定義,以便構建其他應用程序取決於它 – AntJavaDev 2014-10-02 06:51:18