我幾天前開始使用maven,我試圖使用jquery日曆工具,所以當我嘗試添加依賴項時,maven提出了WAR依賴關係,我很好奇,打開它並確實包含必需的導入類。 但我的IDE告訴我,導入沒有解決!我不明白髮生了什麼,我搜索瞭解什麼是戰爭,我創建了這個網絡Java應用程序。作爲一個圖書館使用戰爭是不可能的?這是我的導入不起作用的原因嗎?maven添加戰爭依賴不解決?
下面我POM,設置XML文件和進口在Java代碼中
的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.mycompany</groupId>
<artifactId>gestion_stock</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<repositories>
<repository>
<id>sonatype-snapshots</id>
<name>Sonatype Snapshots Repository</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.googlecode.wicket-jquery-ui</groupId>
<artifactId>wicket-jquery-ui</artifactId>
<version>8.0.0-M3</version>
</dependency>
<dependency>
<groupId>com.googlecode.wicket-jquery-ui</groupId>
<artifactId>jquery-ui-calendar</artifactId>
<version>6.2.2</version>
</dependency>
<dependency>
<groupId>com.googlecode.wicket-jquery-ui</groupId>
<artifactId>jquery-ui-core</artifactId>
<version>6.2.2</version>
</dependency>
<dependency>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-bundle</artifactId>
<version>8.0.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.googlecode.wicket-jquery-ui</groupId>
<artifactId>wicket-jquery-ui-calendar</artifactId>
<version>8.0.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.googlecode.wicket-jquery-ui</groupId>
<artifactId>wicket-jquery-ui-samples</artifactId>
<version>8.0.0-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
<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>
</project>
Setting.xml的
<?xml version="1.0" encoding="UTF-8"?>
<!--
User-specific configuration for maven. Includes things that should not
be distributed with the pom.xml file, such as developer identity, along with
local settings, like proxy information. The default location for the
settings file is ~/.m2/settings.xml
-->
<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">
<!--proxies>
<proxy>
<host>my.proxy.host</host>
</proxy>
</proxies-->
<!--pluginGroups>
<pluginGroup>org.codehaus.mojo</pluginGroup>
</pluginGroups-->
</settings>
ExtendedCalendarPage.java
package com.talcorp.gestion_stock;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import com.googlecode.wicket.jquery.core.Options;
import com.googlecode.wicket.jquery.ui.calendar.Calendar;
import com.googlecode.wicket.jquery.ui.calendar.CalendarView;
import com.googlecode.wicket.jquery.ui.panel.JQueryFeedbackPanel;
// the non working imports in the wicket-jquery-ui-samples-8.0.0-SNAPSHOOT.war
import com.googlecode.wicket.jquery.ui.samples.component.DemoCalendarDialog;
import com.googlecode.wicket.jquery.ui.samples.data.DemoCalendarEvent;
import com.googlecode.wicket.jquery.ui.samples.data.DemoCalendarModel;
import com.googlecode.wicket.jquery.ui.samples.data.dao.CalendarDAO;
public class ExtendedCalendarPage extends AbstractCalendarPage
{
private static final long serialVersionUID = 1L;
private Calendar calendar;
.
.
.
}
注:戰爭是存儲在該項目中的一個文件名爲:非類路徑依賴性
感謝
什麼是WAR依賴於你的項目是指? WAR不是一個庫,它是一個Web應用程序存檔文件。 – Berger
我不知道,正如我所提到的,我在3天前開始使用maven,所以在我加入罐子之前我沒有做過任何事情。 –
哪個導入沒有解決?你的WAR似乎是一個演示應用程序,而不是一個庫。 – Berger