标签: intellij-13

Intellij Idea git 别名

我在 git 中定义了几个别名。我如何在 Intellij Idea 13.1 中使用它?

例如:

文件通用配置

[alias]

new-my-branch = !sh -c 'DATE=$(date +%Y%m%d) && BRANCH_NAME=\"my_super_branch/\"$0\"_\"$DATE && echo $BRANCH_NAME && git checkout -b $BRANCH_NAME && git push-upstream'
Run Code Online (Sandbox Code Playgroud)

git intellij-idea intellij-13

3
推荐指数
1
解决办法
2862
查看次数

从IntelliJ中的"导航文件"中排除项目\文件夹

我正在使用IntelliJ开发Grails应用程序.很多时候都会发生这种情况:当我尝试通过此快捷方式查找文件时:

Ctrl+Shift+N
Run Code Online (Sandbox Code Playgroud)

IntelliJ找到源文件和'编译'(相同)文件(因为grails插件导入到grail应用程序中,整个复制他的文件夹).

有一种方法可以隐藏"导航文件"功能中的项目文件吗?

谢谢

grails intellij-idea intellij-13

3
推荐指数
1
解决办法
346
查看次数

Intellij - 无法启动maven服务 - ExecutionException

我在Ubuntu 14.0.4(amd64),Maven 3.0.5,Java Oracle 1.7.0_72上使用Intellij 13.1.5

我注意到在使用Intellij时maven存在一些不规则性,即在模块或外部Libaries列表中未反映的依赖项添加和删除.

然后当我从shell运行Intellij时,我看到了这个异常:

[  14649]   WARN -      #org.jetbrains.idea.maven - Cannot open index /home/sbotting/.IntelliJIdea13/system/Maven/Indices/Index0 
org.jetbrains.idea.maven.indices.MavenIndexException: Cannot open index /home/sbotting/.IntelliJIdea13/system/Maven/Indices/Index0
   at org.jetbrains.idea.maven.indices.MavenIndex.open(MavenIndex.java:164)
   at org.jetbrains.idea.maven.indices.MavenIndex.<init>(MavenIndex.java:139)
   at org.jetbrains.idea.maven.indices.MavenIndices.load(MavenIndices.java:59)
   at org.jetbrains.idea.maven.indices.MavenIndices.<init>(MavenIndices.java:47)
   at org.jetbrains.idea.maven.indices.MavenIndicesManager.ensureInitialized(MavenIndicesManager.java:107)
   at org.jetbrains.idea.maven.indices.MavenIndicesManager.getIndicesObject(MavenIndicesManager.java:91)
   at org.jetbrains.idea.maven.indices.MavenIndicesManager.ensureIndicesExist(MavenIndicesManager.java:164)
   at org.jetbrains.idea.maven.indices.MavenProjectIndicesManager$3.run(MavenProjectIndicesManager.java:120)
   at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
   at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
   at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
   at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
   at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
   at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
   at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
   at com.intellij.util.Alarm$Request$1.run(Alarm.java:327)
   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
   at com.intellij.util.concurrency.QueueProcessor$RunnableConsumer.consume(QueueProcessor.java:298)
   at com.intellij.util.concurrency.QueueProcessor$RunnableConsumer.consume(QueueProcessor.java:295)
   at com.intellij.util.concurrency.QueueProcessor$2$1.run(QueueProcessor.java:110)
   at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
   at com.intellij.util.concurrency.QueueProcessor$2.consume(QueueProcessor.java:107)
   at com.intellij.util.concurrency.QueueProcessor$2.consume(QueueProcessor.java:104)
   at com.intellij.util.concurrency.QueueProcessor$3$1.run(QueueProcessor.java:215)
   at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
   at com.intellij.util.concurrency.QueueProcessor$3.run(QueueProcessor.java:212)
   at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:419)
   at …
Run Code Online (Sandbox Code Playgroud)

intellij-idea maven-3 maven intellij-13

3
推荐指数
2
解决办法
3634
查看次数

Intellij和sbt 0.13.5"URI有一个权限组件"

我正在使用Java和Amazon Web Services开发一个play框架项目.这是我的build.sbt:

name := """RegistrationEndpoint"""

version := "1.0"

lazy val root = (project in file(".")).enablePlugins(PlayJava)

scalaVersion := "2.11.5"

libraryDependencies ++= Seq(
javaJdbc,
cache,
javaWs
)

// Play provides two styles of routers, one expects its actions to be injected, the
// other, legacy style, accesses its actions statically.
//routesGenerator := InjectedRoutesGenerator
Run Code Online (Sandbox Code Playgroud)

如果我在命令行上调用"activator run",它会与激活器一起运行.

Intellij无法构建项目.它返回以下错误消息

java.lang.IllegalArgumentException: URI has an authority component
    at java.io.File.<init>(File.java:423)
    at sbt.Classpaths$.sbt$Classpaths$$bootRepository(Defaults.scala:1758)
    at sbt.Classpaths$$anonfun$appRepositories$1.apply(Defaults.scala:1729)
    at sbt.Classpaths$$anonfun$appRepositories$1.apply(Defaults.scala:1729)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
    at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:34)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
    at …
Run Code Online (Sandbox Code Playgroud)

java windows sbt playframework intellij-13

3
推荐指数
1
解决办法
3043
查看次数

如何手动安装IntelliJ IDEA补丁更新?

更新代理后IntelliJ时遇到以下连接错误(IntelliJ中的代理ping工作正常):

连接错误:无法准备更新:无法下载" http://download.jetbrains.com/idea/IU-xxx-patch-win.jar ":连接在字节17920处关闭.预计20941088字节.,响应:200 OK打开下载页面.

解?

我可以通过浏览器下载文件... patch-win.jar.我现在如何在Windows环境中为IntelliJ手动安装此补丁?

intellij-idea intellij-13 intellij-14 intellij-15

3
推荐指数
1
解决办法
3636
查看次数

IntelliJ 未检测到 Java 错误

我正在使用 IntelliJ IDEA13 进行使用 hibernate、struts 等的 MVC 项目,但是当我编写代码时,我的 Intellij 没有检测到任何错误,例如当我创建和对象需要某种导入时,即使我做了愚蠢的事情代码中的内容不会以红色显示任何错误。我正在使用 ant 而不是使用 IntelliJ 编译文件,但是 IDE 对于导入和自动完成非常有用,我不知道为什么会发生这种情况。有任何想法吗?

编辑:这只发生在这个 MVC 项目(> 2.000 个文件)中,在普通的 Java 项目中一切都很好。

我有 1 个名为“project1”的文件夹,在该文件夹内我还有其他 2 个文件夹:common 包含我需要的所有 jar,impl 包含项目的所有文件。

在此输入图像描述

因此,我将所有这些内容放入 IntelliJ 中的方法是创建一个名为“project1”的新项目,以便 IntelliJ 获取所有文件夹和文件。

可能是因为这个原因,配置有问题。

只是一个简单的例子,如果我打电话,Query q = createQuery("select * c.name from c in class " + Category.class.getName() + " order by c.name desc"); 我没有类 Query 的导入,因此 IntelliJ 应该告诉我导入该类并使 Query 变为红色,但它没有,甚至当我在 Query 中单击 alt+enter 时它也没有不向我显示导入该类的选项,我的 IntelliJ 不知道代码中存在错误。

EDIT2:我制作了一个新模块,现在一切似乎都正常。我的模块中的源文件夹错误。

java intellij-idea intellij-13

2
推荐指数
1
解决办法
8673
查看次数

Intellij IDEA:固定标签,关闭将关闭.如何禁用?

我有一个关闭标签的热键,CTRL + W但它甚至关闭了固定的标签.

标签上的[X]也是如此.

右键单击 - >关闭选项卡也是如此.

这是一个错误吗?

它并没有像这样.

我在intellij 13

intellij-idea intellij-13

2
推荐指数
2
解决办法
1136
查看次数

如何在IntelliJ IDEA中为Web项目配置资源根

我正在使用 IntelliJ IDEA 13.1.4 中的一个带有 PHP 插件(不是 PHPStorm)的单个“静态 Web”模块的项目。

给定以下目录结构:

-ProjectX
--application
--www
Run Code Online (Sandbox Code Playgroud)

我将“www”文件夹标记为“资源根”。“ProjectX”文件夹是“内容根”。

仅在“www”文件夹中的文件中才能正确解析对资源的 HTML 引用,而在“application”文件夹中则不能正确解析。带注释的截图:

在此输入图像描述

在此输入图像描述

这适用于 PHPStorm,但不适用于 IntelliJ IDEA。如何在 IntelliJ 中获得所需的行为,以便从所有项目文件夹中解析引用?

intellij-idea intellij-13

2
推荐指数
1
解决办法
1278
查看次数

在PHPStorm中,在使用实时模板时,如何用空格替换下划线?

我在PHPStorm中使用实时模板,使用我定义的变量轻松创建代码块.我创建了一个实时模板块,使用刀片模板引擎为文本表单字段创建一组元素.

<!--- $VALUE$ Field --->
<div class="form-group">
    {{ Form::label('$NAME$', '$VALUE$') }}
    {{ Form::text('$NAME$', null, []) }}
</div>
Run Code Online (Sandbox Code Playgroud)

我设置了变量,这样我就可以先用全部小写字母输入NAME变量,然后在大写第一个字母时自动为我填写VALUE变量.

在此输入图像描述

以下是名称变量是单个单词时如何解决的示例:

<!--- Address Field --->
<div class="form-group">
    {{ Form::label('address', 'Address') }}
    {{ Form::text('address', null, []) }}
</div>
Run Code Online (Sandbox Code Playgroud)

这很好用,但是当字段名称有两个单词时我遇到了问题.我更喜欢在两个单词之间使用下划线作为NAME属性,不幸的是,下划线也出现在VALUE变量中.

<!--- Zip_code Field --->
<div class="form-group">
    {{ Form::label('zip_code', 'Zip_code') }}
    {{ Form::text('zip_code', null, []) }}
</div>
Run Code Online (Sandbox Code Playgroud)

我在实时模板变量设置中找不到允许我用空格替换下划线的表达式.理想情况下,我希望保留第一个字母大写,同时还用VALUE变量的空格替换任何下划线.我有什么想法可以达到这个目的吗?

live-templates phpstorm blade intellij-13

2
推荐指数
1
解决办法
879
查看次数

Intellij IDEA在单元测试中警告@Nonnull注释

假设我有一个方法,其中一些参数用javax @Nonnull注释注释.

public Something supply(@Nonnull SomeObject someObject) {
    (...)
    if (someObject == null) throw new ValidationException("Required parameter is null");
    (...)
}
Run Code Online (Sandbox Code Playgroud)

当我尝试使用显式null参数调用此方法时,IDE正确地通知我,如下所示:

somethingSupplier.supply(null);
Run Code Online (Sandbox Code Playgroud)

现在我想要做的是创建单元测试,检查是否会抛出适当的异常,如果由于某种原因传递给此方法的参数恰好为null(假设它是某种验证异常).

如果我尝试像上面的例子中那样调用这个方法,IDE会警告我将null传递给@Nonnull ......但这正是我想在这里做的.我可以注释调用或方法甚至测试类@SuppressWarnings("ConstantConditions"),但它会使代码混乱,我可能不会收到有关我在代码中做出的其他无意错误的警告.

所以问题是我是否能以某种方式禁用测试类中对@Nonnull的检查?或许我不应该对这些案件进行单元测试?

java unit-testing intellij-idea java-8 intellij-13

2
推荐指数
1
解决办法
2034
查看次数

TestNG -Process完成,退出代码为0

我在用Testng,我有两节课Util and test1.

我在Test1类打印中有4个简单的测试方法,只是方法的名称.在运行时testng.xml,它会打印每个方法的预期语句一秒钟,然后将其替换为错误 - 处理完成后退出代码为0.我正在使用Intellij IDE.任何人都可以对此提出任何建议

代码:

class util {....}
class tets1 {
@Test
public void testmethod2(){
System.out.println("In testmethod2");
}

@Test
public void testmethod3(){
System.out.println("In testmetho3");
}

 @Test
 public void testmethod4()
 {
 System.out.println("In testmethod4");
 }

 @Test
 public void testmethod5(){
 System.out.println("In testmetho5");
 }
Run Code Online (Sandbox Code Playgroud)

testng.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="Suite1">
<test name="test1">
<classes>
<class name="TagPackage.Test1"/>
</classes>
</test>
</suite>    
Run Code Online (Sandbox Code Playgroud)

java testng unit-testing intellij-13

1
推荐指数
1
解决办法
1万
查看次数